historydb

package
v0.0.0-...-8b03266 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

README

历史数据库

状态变更历史

记录了每个合约的每个状态的变更历史,只支持PutState的状态变更历史,不支持SQL语句的状态变更历史。 状态历史表的主键为: ContractName+StateKey+BlockHeight+TxId

账户发起交易历史

记录了每个账户发起的TxId的历史,其主键为: AccountId+BlockHeight+ TxId

合约被调用历史

记录了每个合约在哪个TxId中被调谁用了。其主键为: ContractName+BlockHeight+ TxId+AccountId

SQL DB

数据库名: chainId+"_historydb"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeightTxId

type BlockHeightTxId struct {
	BlockHeight uint64
	TxId        string
}

type HistoryDB

type HistoryDB interface {
	InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error
	// CommitBlock commits the block rwsets in an atomic operation
	CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, isCache bool) error

	//GetHistoryForKey 获得Key的交易历史
	GetHistoryForKey(contractName string, key []byte) (HistoryIterator, error)
	GetAccountTxHistory(account []byte) (HistoryIterator, error)
	GetContractTxHistory(contractName string) (HistoryIterator, error)
	// GetLastSavepoint returns the last block height
	GetLastSavepoint() (uint64, error)

	// Close is used to close database
	Close()
}

HistoryDB provides handle to rwSets instances

type HistoryIterator

type HistoryIterator interface {
	Next() bool
	Value() (*BlockHeightTxId, error)
	Release()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL