historydb

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 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
}

BlockHeightTxId struct @Description:

type HistoryDB

type HistoryDB interface {

	// InitGenesis
	// @Description:
	// @param genesisBlock
	// @return error
	InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error

	// CommitBlock
	// @Description: commits the block rwsets in an atomic operation
	// @param blockInfo
	// @param isCache
	// @return error
	CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, isCache bool) error

	// GetHistoryForKey
	// @Description: 获得Key的交易历史
	// @param contractName
	// @param key
	// @return HistoryIterator
	// @return error
	GetHistoryForKey(contractName string, key []byte) (HistoryIterator, error)

	// GetAccountTxHistory
	// @Description:
	// @param account
	// @return HistoryIterator
	// @return error
	GetAccountTxHistory(account []byte) (HistoryIterator, error)

	// GetContractTxHistory
	// @Description:
	// @param contractName
	// @return HistoryIterator
	// @return error
	GetContractTxHistory(contractName string) (HistoryIterator, error)

	// GetLastSavepoint
	// @Description: returns the last block height
	// @return uint64
	// @return error
	GetLastSavepoint() (uint64, error)

	// ImportSetSavePoint, set up savePoint when import snapshot
	ImportSetSavePoint(height uint64) error

	// Close
	// @Description: Close is used to close database
	Close()
}

HistoryDB provides handle to rwSets instances @Description:

type HistoryIterator

type HistoryIterator interface {

	// Next
	// @Description:
	// @return bool
	Next() bool

	// Value
	// @Description:
	// @return *BlockHeightTxId
	// @return error
	Value() (*BlockHeightTxId, error)

	// Release
	// @Description:
	Release()
}

HistoryIterator interface @Description:

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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