chain_indexer

package
v0.0.0-...-a173fca Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MODULENAME = "chain_indexer"
)

Variables

View Source
var (
	DefaultConfig = &ChainIndexerConfig{
		Enable:      true,
		SectionSize: 4096,
		ConfirmsReq: 256,
		Throttling:  100 * time.Millisecond,
	}
)
View Source
var (
	EnableChainIndexerFlag = cli.BoolFlag{
		Name:  "enableChainIndexer",
		Usage: "enable ChainIndexer",
	}
)

Functions

This section is empty.

Types

type ChainIndexerChain

type ChainIndexerChain interface {
	// GetCurrentHeader retrieves the latest locally known header.
	GetCurrentHeader() *types.BlockHeader

	// NewBlockFeed return feed to subscribe new head header notifications.
	NewBlockFeed() *event.Feed
}

ChainIndexerChain interface is used for connecting the indexer to a blockchain

type ChainIndexerConfig

type ChainIndexerConfig struct {
	Enable      bool          `json:"enable"`
	SectionSize uint64        `json:"sectionsize"` // Number of blocks in a single chain segment to process
	ConfirmsReq uint64        `json:"confirmsreq"` // Number of confirmations before processing a completed segment
	Throttling  time.Duration `json:"throttling"`  // Disk throttling to prevent a heavy upgrade from hogging resources
}

type ChainIndexerService

type ChainIndexerService struct {
	DatabaseService *database.DatabaseService   `service:"database"`
	ChainService    chain.ChainServiceInterface `service:"chain"`
	Config          *ChainIndexerConfig
	// contains filtered or unexported fields
}

func (*ChainIndexerService) Api

func (chainIndexer *ChainIndexerService) Api() []app.API

func (*ChainIndexerService) BloomStatus

func (chainIndexer *ChainIndexerService) BloomStatus() (uint64, uint64)

func (*ChainIndexerService) CommandFlags

func (chainIndexer *ChainIndexerService) CommandFlags() ([]cli.Command, []cli.Flag)

func (*ChainIndexerService) DefaultConfig

func (chainIndexer *ChainIndexerService) DefaultConfig(netType params.NetType) *ChainIndexerConfig

func (*ChainIndexerService) GetConfig

func (chainIndexer *ChainIndexerService) GetConfig() *ChainIndexerConfig

func (*ChainIndexerService) GetIndexerStore

func (chainIndexer *ChainIndexerService) GetIndexerStore() *ChainIndexerStore

func (*ChainIndexerService) Init

func (chainIndexer *ChainIndexerService) Init(executeContext *app.ExecuteContext) error

func (*ChainIndexerService) Name

func (chainIndexer *ChainIndexerService) Name() string

func (*ChainIndexerService) Sections

func (chainIndexer *ChainIndexerService) Sections() (uint64, uint64, crypto.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 (*ChainIndexerService) Start

func (chainIndexer *ChainIndexerService) Start(executeContext *app.ExecuteContext) error

func (*ChainIndexerService) Stop

func (chainIndexer *ChainIndexerService) Stop(executeContext *app.ExecuteContext) error

type ChainIndexerServiceInterface

type ChainIndexerServiceInterface interface {
	app.Service
	BloomStatus() (uint64, uint64)
	GetConfig() *ChainIndexerConfig
	GetIndexerStore() *ChainIndexerStore
}

type ChainIndexerStore

type ChainIndexerStore struct {
	dbinterface.KeyValueStore
	// contains filtered or unexported fields
}

func NewChainIndexerStore

func NewChainIndexerStore(store dbinterface.KeyValueStore) *ChainIndexerStore

func (*ChainIndexerStore) FindCommonAncestor

func (chainIndexerStore *ChainIndexerStore) FindCommonAncestor(a, b *types.BlockHeader) *types.BlockHeader

func (*ChainIndexerStore) ReadBloomBits

func (chainIndexerStore *ChainIndexerStore) ReadBloomBits(bit uint, section uint64, head crypto.Hash) ([]byte, error)

ReadBloomBits retrieves the compressed bloom bit vector belonging to the given section and bit index from the.

Jump to

Keyboard shortcuts

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