indexer

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewIndexerFuncName = "NewIndexer"

NewIndexerFuncName plugin looks up name.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Used by dex/backend init flow.
	Enable bool

	// Plugin path for building components.
	Plugin string

	// PluginFlags for construction if needed.
	PluginFlags string

	// The genesis block from dex.Config
	Genesis *core.Genesis

	// Protocol options from dex.Config (partial)
	NetworkID uint64
	SyncMode  downloader.SyncMode
}

Config is data sources related configs struct.

type Indexer

type Indexer interface {
	// Start is called by dex.Dexon if config is set.
	Start() error

	// Stop is called by dex.Dexon if config is set and procedure is
	// terminating.
	Stop() error
}

Indexer defines indexer daemon interface. The daemon would hold a core.Blockhain, passed by initialization function, to receiving latest block event or other information query and interaction.

func NewIndexerFromConfig

func NewIndexerFromConfig(bc ReadOnlyBlockChain, c Config) (idx Indexer)

NewIndexerFromConfig initialize exporter according to given config.

type NewIndexerFunc

type NewIndexerFunc = func(ReadOnlyBlockChain, Config) Indexer

NewIndexerFunc init function alias.

type ROBlockChain

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

ROBlockChain struct for safe read.

type ReadOnlyBlockChain

type ReadOnlyBlockChain interface {
	BadBlocks() []*types.Block
	Config() *params.ChainConfig
	CurrentBlock() *types.Block
	CurrentFastBlock() *types.Block
	CurrentHeader() *types.Header
	Engine() consensus.Engine
	GasLimit() uint64
	Genesis() *types.Block
	GetAncestor(common.Hash, uint64, uint64, *uint64) (common.Hash, uint64)
	GetBlock(common.Hash, uint64) *types.Block
	GetBlockByHash(common.Hash) *types.Block
	GetBlockByNumber(uint64) *types.Block
	GetBlockHashesFromHash(common.Hash, uint64) []common.Hash
	GetBlocksFromHash(common.Hash, int) (blocks []*types.Block)
	GetBody(common.Hash) *types.Body
	GetBodyRLP(common.Hash) rlp.RawValue
	GetGovStateByHash(common.Hash) (*types.GovState, error)
	GetGovStateByNumber(uint64) (*types.GovState, error)
	GetHeader(common.Hash, uint64) *types.Header
	GetHeaderByHash(common.Hash) *types.Header
	GetHeaderByNumber(number uint64) *types.Header
	GetReceiptsByHash(common.Hash) types.Receipts
	GetRoundHeight(uint64) (uint64, bool)
	GetTd(common.Hash, uint64) *big.Int
	GetTdByHash(common.Hash) *big.Int
	GetUnclesInChain(*types.Block, int) []*types.Header
	GetVMConfig() *vm.Config
	HasBlock(common.Hash, uint64) bool
	HasBlockAndState(common.Hash, uint64) bool
	HasHeader(common.Hash, uint64) bool
	HasState(common.Hash) bool
	Processor() core.Processor
	State() (*state.StateDB, error)
	StateAt(root common.Hash) (*state.StateDB, error)
	StateCache() state.Database
	SubscribeChainEvent(chan<- core.ChainEvent) event.Subscription
	SubscribeChainHeadEvent(chan<- core.ChainHeadEvent) event.Subscription
	SubscribeChainSideEvent(chan<- core.ChainSideEvent) event.Subscription
	SubscribeLogsEvent(chan<- []*types.Log) event.Subscription
	SubscribeRemovedLogsEvent(chan<- core.RemovedLogsEvent) event.Subscription
}

ReadOnlyBlockChain defines safe reading blockchain interface by removing write methods of core.BlockChain struct.

func NewROBlockChain

func NewROBlockChain(bc *core.BlockChain) ReadOnlyBlockChain

NewROBlockChain converts original block chain to readonly interface.

Jump to

Keyboard shortcuts

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