Documentation ¶
Overview ¶
Package bigfilterkvdb package @Description:
Index ¶
- type BigFilterKvDB
- func (t *BigFilterKvDB) Close()
- func (t *BigFilterKvDB) CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, isCache bool) error
- func (t *BigFilterKvDB) GetLastSavepoint() (uint64, error)
- func (t *BigFilterKvDB) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error
- func (t *BigFilterKvDB) TxExists(txId string) (bool, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BigFilterKvDB ¶
type BigFilterKvDB struct { sync.RWMutex Cache types.ConcurrentMap // contains filtered or unexported fields }
BigFilterKvDB provider a implementation of `bigfilterdb.BigFilterDB` This implementation provides a key-value based data model
func NewBigFilterKvDB ¶
func NewBigFilterKvDB(n int, m uint, fpRate float64, logger protocol.Logger, redisServerCluster []string, pass *string, name string) (*BigFilterKvDB, error)
NewBigFilterKvDB construct BigFilterKvDB
@Description: @param n @param m @param fpRate @param logger @param redisServerCluster @param pass @param name @return *BigFilterKvDB @return error
func (*BigFilterKvDB) Close ¶
func (t *BigFilterKvDB) Close()
Close is used to close database
@Description: @receiver t
func (*BigFilterKvDB) CommitBlock ¶
func (t *BigFilterKvDB) CommitBlock(blockInfo *serialization.BlockWithSerializedInfo, isCache bool) error
CommitBlock commits the txId and savepoint in an atomic operation
@Description: @receiver t @param blockInfo @param isCache @return error
func (*BigFilterKvDB) GetLastSavepoint ¶
func (t *BigFilterKvDB) GetLastSavepoint() (uint64, error)
GetLastSavepoint returns the last block height
@Description: @receiver t @return uint64 @return error
func (*BigFilterKvDB) InitGenesis ¶
func (t *BigFilterKvDB) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error
InitGenesis 初始化创世块,写入创世块
@Description: @receiver t @param genesisBlock @return error
func (*BigFilterKvDB) TxExists ¶
func (t *BigFilterKvDB) TxExists(txId string) (bool, bool, error)
TxExists add next time
@Description: @receiver t @param txId @return bool @return bool @return error
BigFilters has a non-zero probability of false positives BigFilters returns true if the tx exist, or returns false if none exists. Returns: (bool: true real exist, bool: true maybe exist , error: errinfo) 如果从cache中找到了,那么key 真存在,第一个bool 返回true 如果cache中未找到,从t.filter中 也未找到,那么 第一个bool,第二个bool,返回false 如果cache中未找到,t.filter中找到,返回 false,true, 这时可能是假阳性的