Documentation ¶
Index ¶
- type BloomIndexer
- type ChainIndexer
- func (c *ChainIndexer) AddCheckpoint(section uint64, shead common.Hash)
- func (c *ChainIndexer) AddChildIndexer(indexer *ChainIndexer)
- func (c *ChainIndexer) Close() error
- func (c *ChainIndexer) Prune(threshold uint64) error
- func (c *ChainIndexer) SectionHead(section uint64) common.Hash
- func (c *ChainIndexer) Sections() (uint64, uint64, common.Hash)
- func (c *ChainIndexer) Start(chain abstract.ChainIndexerChain)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BloomIndexer ¶
type BloomIndexer struct {
// contains filtered or unexported fields
}
BloomIndexer implements a core.ChainIndexer, building up a rotated bloom bits index for the Ethereum header bloom filters, permitting blazing fast filtering.
func (*BloomIndexer) Commit ¶
func (b *BloomIndexer) Commit() error
Commit implements core.ChainIndexerBackend, finalizing the bloom section and writing it out into the database.
func (*BloomIndexer) Process ¶
Process implements core.ChainIndexerBackend, adding a new header's bloom into the index.
func (*BloomIndexer) Prune ¶
func (b *BloomIndexer) Prune(threshold uint64) error
Prune returns an empty error since we don't support pruning here.
type ChainIndexer ¶
type ChainIndexer struct {
// contains filtered or unexported fields
}
ChainIndexer does a post-processing job for equally sized sections of the canonical chain (like BlooomBits and CHT structures). A ChainIndexer is connected to the blockchain through the event system by starting a ChainHeadEventLoop in a goroutine.
Further child ChainIndexers can be added which use the output of the parent section indexer. These child indexers receive new head notifications only after an entire section has been finished or in case of rollbacks that might affect already finished sections.
func NewBloomIndexer ¶
func NewBloomIndexer(db ethdb.Database, size, confirms uint64) *ChainIndexer
NewBloomIndexer returns a chain indexer that generates bloom bits data for the canonical chain for fast logs filtering.
func NewChainIndexer ¶
func NewChainIndexer(chainDb ethdb.Database, indexDb ethdb.Database, backend abstract.ChainIndexerBackend, section, confirm uint64, throttling time.Duration, kind string) *ChainIndexer
NewChainIndexer creates a new chain indexer to do background processing on chain segments of a given size after certain number of confirmations passed. The throttling parameter might be used to prevent database thrashing.
func (*ChainIndexer) AddCheckpoint ¶
func (c *ChainIndexer) AddCheckpoint(section uint64, shead common.Hash)
AddCheckpoint adds a checkpoint. Sections are never processed and the chain is not expected to be available before this point. The indexer assumes that the backend has sufficient information available to process subsequent sections.
Note: knownSections == 0 and storedSections == checkpointSections until syncing reaches the checkpoint
func (*ChainIndexer) AddChildIndexer ¶
func (c *ChainIndexer) AddChildIndexer(indexer *ChainIndexer)
AddChildIndexer adds a child ChainIndexer that can use the output of this one
func (*ChainIndexer) Close ¶
func (c *ChainIndexer) Close() error
Close tears down all goroutines belonging to the indexer and returns any error that might have occurred internally.
func (*ChainIndexer) Prune ¶
func (c *ChainIndexer) Prune(threshold uint64) error
Prune deletes all chain data older than given threshold.
func (*ChainIndexer) SectionHead ¶
func (c *ChainIndexer) SectionHead(section uint64) common.Hash
SectionHead retrieves the last block hash of a processed section from the index database.
func (*ChainIndexer) Sections ¶
func (c *ChainIndexer) Sections() (uint64, uint64, common.Hash)
Sections returns the number of processed sections maintained by the indexer and also the information about the last header indexed for potential canonical verifications.
func (*ChainIndexer) Start ¶
func (c *ChainIndexer) Start(chain abstract.ChainIndexerChain)
Start creates a goroutine to feed chain head events into the indexer for cascading background processing. Children do not need to be started, they are notified about new events by their parents.