indexservice

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	NumDelegates          uint64                `yaml:"numDelegates"`
	NumCandidateDelegates uint64                `yaml:"numCandidateDelegates"`
	NumSubEpochs          uint64                `yaml:"numSubEpochs"`
	RangeQueryLimit       uint64                `yaml:"rangeQueryLimit"`
	Genesis               indexprotocol.Genesis `yaml:"genesis"`
}

Config contains indexer configs

type Indexer

type Indexer struct {
	Store          s.Store
	Registry       *indexprotocol.Registry
	IndexProtocols []indexprotocol.Protocol
	Config         Config
	// contains filtered or unexported fields
}

Indexer handles the index build for blocks

func NewIndexer

func NewIndexer(store s.Store, cfg Config) *Indexer

NewIndexer creates a new indexer

func (*Indexer) CreateTablesIfNotExist

func (idx *Indexer) CreateTablesIfNotExist() error

CreateTablesIfNotExist creates tables in local database

func (*Indexer) IndexInBatch

func (idx *Indexer) IndexInBatch(ctx context.Context, tipHeight uint64) error

IndexInBatch indexes blocks in batch

func (*Indexer) Initialize

func (idx *Indexer) Initialize(genesis *indexprotocol.Genesis) error

Initialize initialize the registered protocols

func (*Indexer) RegisterDefaultProtocols

func (idx *Indexer) RegisterDefaultProtocols() error

RegisterDefaultProtocols registers default protocols to hte indexer

func (*Indexer) RegisterProtocol

func (idx *Indexer) RegisterProtocol(protocolID string, protocol indexprotocol.Protocol) error

RegisterProtocol registers a protocol to the indexer

func (*Indexer) Start

func (idx *Indexer) Start(ctx context.Context) error

Start starts the indexer

func (*Indexer) Stop

func (idx *Indexer) Stop(ctx context.Context) error

Stop stops the indexer

func (*Indexer) SubscribeNewBlock

func (idx *Indexer) SubscribeNewBlock(
	client iotexapi.APIServiceClient,
	height chan uint64,
	report chan error,
	unsubscribe chan bool,
)

SubscribeNewBlock polls the new block height from the chain

Jump to

Keyboard shortcuts

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