store

package module
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: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//StoreBlockDBDir blockdb folder name
	StoreBlockDBDir = "store_block"
	//StoreStateDBDir statedb folder name
	StoreStateDBDir = "store_state"
	//StoreHistoryDBDir historydb folder name
	StoreHistoryDBDir = "store_history"
	//StoreResultDBDir resultdb folder name
	StoreResultDBDir   = "store_result"
	StoreEventLogDBDir = "store_event_log"
	StoreLocalDBDir    = "localdb"
	StoreTxExistDbDir  = "store_txexist"

	DBName_BlockDB   = "blockdb"
	DBName_StateDB   = "statedb"
	DBName_HistoryDB = "historydb"
	DBName_ResultDB  = "resultdb"
	DBName_EventDB   = "eventdb"
	DBName_LocalDB   = "localdb"
	DBName_TxExistDB = "txexistdb"

	DBHandleBlockName    = "newDBHandleName" + DBName_BlockDB
	SqlDBHandleBlockName = "newSqlDBhandleName" + DBName_BlockDB

	DBHandleStateName    = "newDBHandleName" + DBName_StateDB
	SqlDBHandleStateName = "newSqlDBhandleName" + DBName_StateDB

	DBHandleHistoryName    = "newDBHandleName" + DBName_HistoryDB
	SqlDBHandleHistoryName = "newSqlDBhandleName" + DBName_HistoryDB

	DBHandleResultName    = "newDBHandleName" + DBName_ResultDB
	SqlDBHandleResultName = "newSqlDBhandleName" + DBName_ResultDB

	DBHandleEventName    = "newDBHandleName" + DBName_EventDB
	SqlDBHandleEventName = "newSqlDBhandleName" + DBName_EventDB

	DBHandleTxExistName    = "newDBHandleName" + DBName_TxExistDB
	SqlDBHandleTxExistName = "newSqlDBhandleName" + DBName_TxExistDB

	DBHandleLocalName    = "newDBHandleName" + DBName_LocalDB
	SqlDBHandleLocalName = "newSqlDBhandleName" + DBName_LocalDB

	BlockKvDB    = "NewBlockKvDB"
	BlockSQLDB   = "NewBlockSqlDB"
	BlockFileDB  = "NewBlockFileDB"
	StateKvDB    = "NewStateKvDB"
	StateSQLDB   = "NewStateSqlDB"
	HistoryKvDB  = "NewHistoryKvDB"
	HistorySQLDB = "NewHistorySqlDB"
	ResultKvDB   = "NewResultKvDB"
	ResultSQLDB  = "NewResultSqlDB"
	ResultFileDB = "NewResultFileDB"

	WrapTxExistDB = "NewExistDB"
	TxExistKvDB   = "NewExistKvDB"

	EventSQLDB = "NewEventSqlDB"

	WAL       = "NewWAL"
	BlockFile = "NewBF"

	META      = "NewMeta"
	BigFilter = "NewBigFilter"
	RWC       = "NewRollingWindowCache"
	Encryptor = "NewEncryptor"

	LedgerSnapshot       = "NewLedgerSnapshot"
	ImportLedgerSnapshot = "NewImportLedgerSnapshot"
)

nolint

Variables

View Source
var (
	ErrConversionInterface = errors.New("interface conversion error")
)

nolint

Functions

func NewAsyncBlockStoreImpl

func NewAsyncBlockStoreImpl(blockStoreImpl protocol.BlockchainStore, logger protocol.Logger) protocol.BlockchainStore

NewAsyncBlockStoreImpl add next time

@Description:
@param blockStoreImpl
@param logger
@return protocol.BlockchainStore

func WrapBlockDB2TxExistDB

func WrapBlockDB2TxExistDB(db blockdb.BlockDB, log protocol.Logger) txexistdb.TxExistDB

WrapBlockDB2TxExistDB 创建一个使用了blockDB的 txExistDB

Types

type AsyncBlockStoreImpl

type AsyncBlockStoreImpl struct {
	protocol.BlockchainStore
	// contains filtered or unexported fields
}

AsyncBlockStoreImpl Asynchronous storage of block data.

@Description:

func (*AsyncBlockStoreImpl) GetBlock

func (async *AsyncBlockStoreImpl) GetBlock(height uint64) (*commonPb.Block, error)

GetBlock returns a block given its block height, or returns nil if none exists.

@Description:
@receiver async
@param height
@return *commonPb.Block
@return error

func (*AsyncBlockStoreImpl) PutBlock

func (async *AsyncBlockStoreImpl) PutBlock(block *commonPb.Block, txRWSets []*commonPb.TxRWSet) error

PutBlock Asynchronous storage of block data.

@Description:
@receiver async
@param block
@param txRWSets
@return error

The block data will be cached and stored by idle working GO routines later. Note: Concurrent calls are not allowed

type BlockStoreImpl

type BlockStoreImpl struct {
	ArchiveMgr *archive.ArchiveMgr
	// contains filtered or unexported fields
}

BlockStoreImpl provides an implementation of `protocol.BlockchainStore`. @Description:

func NewBlockStoreImpl

func NewBlockStoreImpl(chainId string,
	storeConfig *conf.StorageConfig,
	blockDB blockdb.BlockDB,
	stateDB statedb.StateDB,
	historyDB historydb.HistoryDB,
	contractEventDB contracteventdb.ContractEventDB,
	resultDB resultdb.ResultDB,
	txExistDB txexistdb.TxExistDB,
	commonDB protocol.DBHandle,
	logger protocol.Logger,
	bfdb binlog.BinLogger,
	walLog *wal.Log,
	bigFilterDB bigfilterdb.BigFilterDB,
	rwCache rolling_window_cache.RollingWindowCache,
	meta meta.MetaData,
	ledgerSnapshot snapshot.LedgerSnapshot) (*BlockStoreImpl, error)

NewBlockStoreImpl constructs new `BlockStoreImpl` @Description: @param chainId @param storeConfig @param blockDB @param stateDB @param historyDB @param contractEventDB @param resultDB @param txExistDB @param commonDB @param logger @param bfdb @param walLog @param bigFilterDB @param rwCache @return *BlockStoreImpl @return error

func (*BlockStoreImpl) ArchiveBlock

func (bs *BlockStoreImpl) ArchiveBlock(archiveHeight uint64) error

ArchiveBlock the block after backup @Description: @receiver bs @param archiveHeight @return error

func (*BlockStoreImpl) BeginDbTransaction

func (bs *BlockStoreImpl) BeginDbTransaction(txName string) (protocol.SqlDBTransaction, error)

BeginDbTransaction 启用一个事务

@Description:
@receiver bs
@param txName
@return protocol.SqlDBTransaction
@return error

func (*BlockStoreImpl) BlockExists

func (bs *BlockStoreImpl) BlockExists(blockHash []byte) (bool, error)

BlockExists returns true if the black hash exist, or returns false if none exists. @Description: @receiver bs @param blockHash @return bool @return error

func (*BlockStoreImpl) Close

func (bs *BlockStoreImpl) Close() error

Close Close is used to close database @Description: @receiver bs @return error

func (*BlockStoreImpl) CommitDbTransaction

func (bs *BlockStoreImpl) CommitDbTransaction(txName string) error

CommitDbTransaction 提交一个事务

@Description:
@receiver bs
@param txName
@return error

func (*BlockStoreImpl) CommonPutBlock

func (bs *BlockStoreImpl) CommonPutBlock(block *commonPb.Block, txRWSets []*commonPb.TxRWSet) error

CommonPutBlock add next time @Description: 普通写模式,占用资源少,写入慢 1.写wal 2.写kvdb cache 或者 sql 3.写kvdb 或者什么都不做 4.删除过期的wal @receiver bs @param block @param txRWSets @return error

func (*BlockStoreImpl) CreateDatabase

func (bs *BlockStoreImpl) CreateDatabase(contractName string) error

CreateDatabase add next time

@Description:
@receiver bs
@param contractName
@return error

func (*BlockStoreImpl) DoHotColdDataSeparation

func (bs *BlockStoreImpl) DoHotColdDataSeparation(startHeight uint64, endHeight uint64) (string, error)

DoHotColdDataSeparation create a new task , that move cold block data to archive file system

func (*BlockStoreImpl) DropDatabase

func (bs *BlockStoreImpl) DropDatabase(contractName string) error

DropDatabase 删除一个合约对应的数据库

@Description:
@receiver bs
@param contractName
@return error

func (*BlockStoreImpl) ExecDdlSql

func (bs *BlockStoreImpl) ExecDdlSql(contractName, sql, version string) error

ExecDdlSql execute DDL SQL in a contract

@Description:
@receiver bs
@param contractName
@param sql
@param version
@return error

func (*BlockStoreImpl) GetAccountTxHistory

func (bs *BlockStoreImpl) GetAccountTxHistory(accountId []byte) (protocol.TxHistoryIterator, error)

GetAccountTxHistory add next time @Description: @receiver bs @param accountId @return protocol.TxHistoryIterator @return error

func (*BlockStoreImpl) GetArchiveStatus added in v3.0.1

func (bs *BlockStoreImpl) GetArchiveStatus() (*storePb.ArchiveStatus, error)

GetArchiveStatus get archive status (not implemented)

@Description:
@receiver bs
@return *storePb.ArchiveStatus
@return error

func (*BlockStoreImpl) GetArchivedPivot

func (bs *BlockStoreImpl) GetArchivedPivot() uint64

GetArchivedPivot return archived pivot

func (*BlockStoreImpl) GetBlock

func (bs *BlockStoreImpl) GetBlock(height uint64) (*commonPb.Block, error)

GetBlock returns a block given it's block height, or returns nil if none exists. @Description: @receiver bs @param height @return *commonPb.Block @return error

func (*BlockStoreImpl) GetBlockByHash

func (bs *BlockStoreImpl) GetBlockByHash(blockHash []byte) (*commonPb.Block, error)

GetBlockByHash returns a block given it's hash, or returns nil if none exists. @Description: @receiver bs @param blockHash @return *commonPb.Block @return error

func (*BlockStoreImpl) GetBlockByTx

func (bs *BlockStoreImpl) GetBlockByTx(txId string) (*commonPb.Block, error)

GetBlockByTx returns a block which contains a tx. @Description: @receiver bs @param txId @return *commonPb.Block @return error

func (*BlockStoreImpl) GetBlockHeaderByHeight

func (bs *BlockStoreImpl) GetBlockHeaderByHeight(height uint64) (*commonPb.BlockHeader, error)

GetBlockHeaderByHeight returns a block header by given it's height, or returns nil if none exists. @Description: @receiver bs @param height @return *commonPb.BlockHeader @return error

func (*BlockStoreImpl) GetBlockWithRWSets

func (bs *BlockStoreImpl) GetBlockWithRWSets(height uint64) (*storePb.BlockWithRWSet, error)

GetBlockWithRWSets returns the block and all the rwsets corresponding to the block, or returns nil if zhe block does not exist @Description: @receiver bs @param height @return *storePb.BlockWithRWSet @return error

func (*BlockStoreImpl) GetContractByName

func (bs *BlockStoreImpl) GetContractByName(name string) (*commonPb.Contract, error)

GetContractByName 获得合约

@Description:
@receiver bs
@param name
@return *commonPb.Contract
@return error

func (*BlockStoreImpl) GetContractBytecode

func (bs *BlockStoreImpl) GetContractBytecode(name string) ([]byte, error)

GetContractBytecode add next time

@Description:
@receiver bs
@param name
@return []byte
@return error

func (*BlockStoreImpl) GetContractDbName

func (bs *BlockStoreImpl) GetContractDbName(contractName string) string

GetContractDbName 获得一个合约对应的状态数据库名

@Description:
@receiver bs
@param contractName
@return string

func (*BlockStoreImpl) GetContractTxHistory

func (bs *BlockStoreImpl) GetContractTxHistory(contractName string) (protocol.TxHistoryIterator, error)

GetContractTxHistory add next time @Description: @receiver bs @param contractName @return protocol.TxHistoryIterator @return error

func (*BlockStoreImpl) GetDBHandle

func (bs *BlockStoreImpl) GetDBHandle(dbName string) protocol.DBHandle

GetDBHandle returns the database handle for given dbName(chainId) @Description: @receiver bs @param dbName @return protocol.DBHandle

func (*BlockStoreImpl) GetDbTransaction

func (bs *BlockStoreImpl) GetDbTransaction(txName string) (protocol.SqlDBTransaction, error)

GetDbTransaction 根据事务名,获得一个已经启用的事务

@Description:
@receiver bs
@param txName
@return protocol.SqlDBTransaction
@return error

func (*BlockStoreImpl) GetHeightByHash

func (bs *BlockStoreImpl) GetHeightByHash(blockHash []byte) (uint64, error)

GetHeightByHash returns a block height given it's hash, or returns nil if none exists. @Description: @receiver bs @param blockHash @return uint64 @return error

func (*BlockStoreImpl) GetHistoryForKey

func (bs *BlockStoreImpl) GetHistoryForKey(contractName string, key []byte) (protocol.KeyHistoryIterator, error)

GetHistoryForKey add next time @Description: @receiver bs @param contractName @param key @return protocol.KeyHistoryIterator @return error

func (*BlockStoreImpl) GetHotColdDataSeparationJobByID

func (bs *BlockStoreImpl) GetHotColdDataSeparationJobByID(jobID string) (storePb.ArchiveJob, error)

GetHotColdDataSeparationJobByID return HotColdDataSeparation job info by job ID

func (*BlockStoreImpl) GetHotColdDataSeparationMaxHeight added in v3.0.1

func (bs *BlockStoreImpl) GetHotColdDataSeparationMaxHeight() (uint64, error)

GetHotColdDataSeparationMaxHeight get the max height which can be used for do hot-cold data separations

func (*BlockStoreImpl) GetLastBlock

func (bs *BlockStoreImpl) GetLastBlock() (*commonPb.Block, error)

GetLastBlock returns the last block. @Description: @receiver bs @return *commonPb.Block @return error

func (*BlockStoreImpl) GetLastChainConfig

func (bs *BlockStoreImpl) GetLastChainConfig() (*configPb.ChainConfig, error)

GetLastChainConfig returns the last chain config @Description: @receiver bs @return *configPb.ChainConfig @return error

func (*BlockStoreImpl) GetLastConfigBlock

func (bs *BlockStoreImpl) GetLastConfigBlock() (*commonPb.Block, error)

GetLastConfigBlock returns the last config block. @Description: @receiver bs @return *commonPb.Block @return error

func (*BlockStoreImpl) GetLastHeight added in v3.0.1

func (bs *BlockStoreImpl) GetLastHeight() (uint64, error)

GetLastHeight get last height

@Description:
@receiver bs
@return uint64
@return error

func (*BlockStoreImpl) GetMemberExtraData

func (bs *BlockStoreImpl) GetMemberExtraData(member *accesscontrol.Member) (*accesscontrol.MemberExtraData, error)

GetMemberExtraData add next time

@Description:
@receiver bs
@param member
@return *accesscontrol.MemberExtraData
@return error

func (*BlockStoreImpl) GetSnapshotStatus

func (bs *BlockStoreImpl) GetSnapshotStatus() uint64

GetSnapshotStatus return last snapshot job's status 0 is unfinished, 1 is finished

func (*BlockStoreImpl) GetTx

func (bs *BlockStoreImpl) GetTx(txId string) (*commonPb.Transaction, error)

GetTx retrieves a transaction by txid, or returns nil if none exists. @Description: @receiver bs @param txId @return *commonPb.Transaction @return error

func (*BlockStoreImpl) GetTxConfirmedTime

func (bs *BlockStoreImpl) GetTxConfirmedTime(txId string) (int64, error)

GetTxConfirmedTime returns the confirmed time of a given tx @Description: @receiver bs @param txId @return int64 @return error

func (*BlockStoreImpl) GetTxHeight

func (bs *BlockStoreImpl) GetTxHeight(txId string) (uint64, error)

GetTxHeight retrieves a transaction height by txid, or returns nil if none exists. @Description: @receiver bs @param txId @return uint64 @return error

func (*BlockStoreImpl) GetTxInfoOnly

func (d *BlockStoreImpl) GetTxInfoOnly(txId string) (*commonPb.TransactionInfo, error)

GetTxInfoOnly add next time @Description: @receiver d @param txId @return *commonPb.TransactionInfo @return error

func (*BlockStoreImpl) GetTxInfoWithRWSet

func (bs *BlockStoreImpl) GetTxInfoWithRWSet(txId string) (*commonPb.TransactionInfoWithRWSet, error)

GetTxInfoWithRWSet return tx and tx info and rw set @Description: @receiver bs @param txId @return *commonPb.TransactionInfoWithRWSet @return error

func (*BlockStoreImpl) GetTxRWSet

func (bs *BlockStoreImpl) GetTxRWSet(txId string) (*commonPb.TxRWSet, error)

GetTxRWSet returns an txRWSet for given txId, or returns nil if none exists. @Description: @receiver bs @param txId @return *commonPb.TxRWSet @return error

func (*BlockStoreImpl) GetTxRWSetsByHeight

func (bs *BlockStoreImpl) GetTxRWSetsByHeight(height uint64) ([]*commonPb.TxRWSet, error)

GetTxRWSetsByHeight returns all the rwsets corresponding to the block, or returns nil if zhe block does not exist @Description: @receiver bs @param height @return []*commonPb.TxRWSet @return error

func (*BlockStoreImpl) GetTxWithInfo

func (d *BlockStoreImpl) GetTxWithInfo(txId string) (*commonPb.TransactionInfo, error)

GetTxWithInfo add next time @Description: @receiver d @param txId @return *commonPb.TransactionInfo @return error

func (*BlockStoreImpl) GetTxWithRWSet

func (bs *BlockStoreImpl) GetTxWithRWSet(txId string) (*commonPb.TransactionWithRWSet, error)

GetTxWithRWSet return tx and it's rw set @Description: @receiver bs @param txId @return *commonPb.TransactionWithRWSet @return error

func (*BlockStoreImpl) InitArchiveMgr

func (bs *BlockStoreImpl) InitArchiveMgr(chainId string) error

InitArchiveMgr 初始化归档管理器

@Description:
@receiver bs
@param chainId
@return error

func (*BlockStoreImpl) InitGenesis

func (bs *BlockStoreImpl) InitGenesis(genesisBlock *storePb.BlockWithRWSet) error

InitGenesis 初始化创世区块到数据库,对应的数据库必须为空数据库,否则报错 @Description: @receiver bs @param genesisBlock @return error

func (*BlockStoreImpl) MakeSnapshot

func (bs *BlockStoreImpl) MakeSnapshot(snapshotHeight uint64) error

MakeSnapshot make a snapshot job

func (*BlockStoreImpl) PutBlock

func (bs *BlockStoreImpl) PutBlock(block *commonPb.Block, txRWSets []*commonPb.TxRWSet) error

PutBlock commits the block and the corresponding rwsets in an atomic operation @Description: 如果是普通写入模式,先后写 kvCache,wal,kvdb 然后返回 如果是快速写模式,先写 kvCache,wal,chan 然后返回 ,chan中数据由单独的groutine负责完成 消费写到 db中 @receiver bs @param block @param txRWSets @return error

func (*BlockStoreImpl) QueryMulti

func (bs *BlockStoreImpl) QueryMulti(contractName, sql string, values ...interface{}) (protocol.SqlRows, error)

QueryMulti 不在事务中,直接查询状态数据库,返回多行结果

@Description:
@receiver bs
@param contractName
@param sql
@param values
@return protocol.SqlRows
@return error

func (*BlockStoreImpl) QuerySingle

func (bs *BlockStoreImpl) QuerySingle(contractName, sql string, values ...interface{}) (protocol.SqlRow, error)

QuerySingle 不在事务中,直接查询状态数据库,返回一行结果

@Description:
@receiver bs
@param contractName
@param sql
@param values
@return protocol.SqlRow
@return error

func (*BlockStoreImpl) QuickPutBlock

func (bs *BlockStoreImpl) QuickPutBlock(block *commonPb.Block, txRWSets []*commonPb.TxRWSet) error

QuickPutBlock 模式,写入和读取性能更好,占用内存更多 @Description: 1.写wal 2.写kvdb cache 或者 sql 3.写channel

判断5种db,是 kv型,还是sql型,kv型 则 因为 kv 型 有对应Cache,可以直接同步更新Cache
如果是sql型,则 因为 sql 型 没有Cache,直接同步更新db
再写 data 到 writeBatchChan
同理,消费 writeBatchChan时,也要 判断,如果是 sql 型,则不需要 消费chan了,因为前面已经 同步更新过了
如果 是 kv 型,则 消费 chan ,然后 同步更新
依次判断 blockDB,stateDB,historyDB,resultDB,contractEventDB 对应是 sql型存储还是 kv型存储
如果是 kv型存储,则直接更新其对应的Cache,如果(是sql型)不是(kv型),则同步更新
根据配置,同步写入对应db或Cache,blockDB,stateDB,historyDB,resultDB,contractEventDB,如果写入失败,直接panic

@receiver bs @param block @param txRWSets @return error

func (*BlockStoreImpl) ReadObject

func (bs *BlockStoreImpl) ReadObject(contractName string, key []byte) ([]byte, error)

ReadObject returns the state value for given contract name and key, or returns nil if none exists. @Description: @receiver bs @param contractName @param key @return []byte @return error

func (*BlockStoreImpl) ReadObjects

func (bs *BlockStoreImpl) ReadObjects(contractName string, keys [][]byte) ([][]byte, error)

ReadObjects returns the state value for given contract name and keys, or returns nil if none exists. @Description: @receiver bs @param contractName @param keys @return [][]byte @return error

func (*BlockStoreImpl) RestoreBlocks

func (bs *BlockStoreImpl) RestoreBlocks(serializedBlocks [][]byte) error

RestoreBlocks restore blocks from outside serialized block data @Description: @receiver bs @param serializedBlocks @return error

func (*BlockStoreImpl) RollbackDbTransaction

func (bs *BlockStoreImpl) RollbackDbTransaction(txName string) error

RollbackDbTransaction 回滚一个事务

@Description:
@receiver bs
@param txName
@return error

func (*BlockStoreImpl) SelectObject

func (bs *BlockStoreImpl) SelectObject(contractName string, startKey []byte, limit []byte) (
	protocol.StateIterator, error)

SelectObject returns an iterator that contains all the key-values between given key ranges. startKey is included in the results and limit is excluded. @Description: @receiver bs @param contractName @param startKey @param limit @return protocol.StateIterator @return error

func (*BlockStoreImpl) TxExists

func (bs *BlockStoreImpl) TxExists(txId string) (bool, error)

TxExists returns true if the tx exist, or returns false if none exists. @Description: @receiver bs @param txId @return bool @return error

func (*BlockStoreImpl) TxExistsInFullDB

func (bs *BlockStoreImpl) TxExistsInFullDB(txId string) (bool, uint64, error)

TxExistsInFullDB returns true and the latest committed block height in db if the tx exist, or returns false and math.MaxUint64 if none exists. @Description: @receiver bs @param txId @return bool @return uint64 @return error

func (*BlockStoreImpl) TxExistsInIncrementDB

func (bs *BlockStoreImpl) TxExistsInIncrementDB(txId string, startHeight uint64) (bool, error)

TxExistsInIncrementDB returns true if the tx exist from starHeight to the latest committed block, or returns false if none exists. @Description: @receiver bs @param txId @param startHeight @return bool @return error

func (*BlockStoreImpl) TxExistsInIncrementDBState

func (bs *BlockStoreImpl) TxExistsInIncrementDBState(txId string, startHeight uint64) (bool, bool, error)

TxExistsInIncrementDBState returns true if the tx exist from starHeight to the latest committed block, or returns false if none exists. @Description: @receiver bs @param txId @param startHeight @return bool @return bool ,true is inside the window, false is outside the window. @return error

func (*BlockStoreImpl) WriteBatchFromChanToDB

func (bs *BlockStoreImpl) WriteBatchFromChanToDB()

WriteBatchFromChanToDB 消费chan 中数据,同步写到db @Description: 从一个chan中,消费需要批量写入的序列化好的块 1.写kvdb 2.删除wal中,当前block前10个block 3.blockWithSerializedInfo 放回对象池 @receiver bs

func (*BlockStoreImpl) WriteKvDb

func (bs *BlockStoreImpl) WriteKvDb(blockWithSerializedInfo *serialization.BlockWithSerializedInfo,
	errsChan chan error) error

WriteKvDb commit block to kvdb @Description: 写 block,state,history,result,bigfilter 5种kvdb,不包含contractevent db, 合约db只有 sql型,没有kv型. @receiver bs @param blockWithSerializedInfo @param errsChan @return error

func (*BlockStoreImpl) WriteKvDbCacheSqlDb

func (bs *BlockStoreImpl) WriteKvDbCacheSqlDb(blockWithSerializedInfo *serialization.BlockWithSerializedInfo,
	errsChan chan error) error

WriteKvDbCacheSqlDb commit block to kvdb cache and sqldb 写block,state,history,result,bigfilter 5种kvdb cache或者对应的sqldb, 写1个 contractEventDB(sqldb), 1个 txExistDB(kvdb) txExistDB不支持sql型, 写1个 rollingWindowCache 一共8个groutine @Description: @receiver bs @param blockWithSerializedInfo @param errsChan @return error

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory is a factory function to create an instance of the block store which commits block into the ledger.

func NewFactory

func NewFactory() *Factory

NewFactory create a factory of storage

func (*Factory) NewImportStore

func (m *Factory) NewImportStore(chainId string, storeConfig *conf.StorageConfig,
	logger protocol.Logger, p11Handle *pkcs11.P11Handle, height uint64) (protocol.ImportLedgerSnapshot, error)

NewImportStore constructs a new ImportBlockStore 创建 ImportLedgerSnapshot 就像堆积木一样,先把 底层对象创建好,再创建中间对象,再创建上层对象

func (*Factory) NewStore

func (m *Factory) NewStore(chainId string, storeConfig *conf.StorageConfig,
	logger protocol.Logger, p11Handle *pkcs11.P11Handle) (protocol.BlockchainStore, error)

NewStore constructs a new BlockStore 创建 BlockchainStore 就像堆积木一样,先把 底层对象创建好,再创建中间对象,再创建上层对象

Directories

Path Synopsis
Package bigfilterdb package
Package bigfilterdb package
bigfilterkvdb
Package bigfilterkvdb package @Description:
Package bigfilterkvdb package @Description:
metadb
Package metadb package
Package metadb package
Package types package @Description:
Package types package @Description:

Jump to

Keyboard shortcuts

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