bloom

package
v2.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockLoader

type BlockLoader interface {
	GetLastHeight() (uint64, error)
	GetBlockWithRWSets(height uint64) (*storePb.BlockWithRWSet, error)
}

BlockLoader used to load blocks As an intermediate conversion, it coverts storeImpl to bloom.BlockLoader

type BloomFilter

type BloomFilter struct {
	*bloom.BlockBloomFilter
	// contains filtered or unexported fields
}

BloomFilter wrapper of bloom.BlockBloomFilter

func NewBloomFilter

func NewBloomFilter(chainId string, config *conf.BloomConfig, logger protocol.Logger,
	blockLoader BlockLoader) (*BloomFilter, error)

NewBloomFilter create a bloom filter based on the bloom config. Firstly create a directory to store the bloom filter data according chainID. Then create the bloom filter with some options based on the bloom config. The bloom filter use key calculate bit generated by contractName and key for format '{contractName}#{key}'

func (*BloomFilter) Close

func (f *BloomFilter) Close() error

Close dump data when close if If configuration item DumpWhenClose is true

type BloomStateDb

type BloomStateDb struct {
	statedb.StateDB
	// contains filtered or unexported fields
}

BloomStateDb is a bloom filter pre-installed for the underlying statedb database.

func NewBloomStateDb

func NewBloomStateDb(stateDB statedb.StateDB, filter *BloomFilter, logger protocol.Logger) *BloomStateDb

NewBloomStateDb create a wrapper using bloom filter for the underlying state db.

func (*BloomStateDb) Close

func (b *BloomStateDb) Close()

Close close the underlying StateDB and dump the bloom filter data to file.

func (*BloomStateDb) CommitBlock

func (b *BloomStateDb) CommitBlock(blockWithRWSet *serialization.BlockWithSerializedInfo, isCache bool) error

CommitBlock commit the block to the underlying StateDB, if successful, add all write sets of the block to the Bloom filter.

func (*BloomStateDb) InitGenesis

func (b *BloomStateDb) InitGenesis(genesisBlock *serialization.BlockWithSerializedInfo) error

InitGenesis init genesis block use the underlying StateDB, if successful, add the write sets of the genesis block to the Bloom filter.

func (*BloomStateDb) ReadObject

func (b *BloomStateDb) ReadObject(contractName string, key []byte) ([]byte, error)

ReadObject if the key exists in the Bloom filter, read from the underlying StateDB. Otherwise return nil.

func (*BloomStateDb) ReadObjects

func (b *BloomStateDb) ReadObjects(contractName string, keys [][]byte) ([][]byte, error)

ReadObjects filter the keys that exist in the Bloom filter, then pass them to the underlying StateDB. The keys not exist in the Bloom filter will be returned as nil.

Jump to

Keyboard shortcuts

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