blockindex

package
v0.30.1-binance.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorHashMissLength = errors.New("the lenght of Block hash is not 32")

---------------------------------------------------- Errors ErrorHashMissLength indicates length of hash is not correct

Functions

This section is empty.

Types

type BlockIndexer

type BlockIndexer interface {

	// Index analyzes, indexes and stores a single (block hash -- block height) key-value.
	Index(block *types.Header) error

	// Get returns the block height specified by hash or 0 if the block is not indexed.
	Get(hash []byte) (int64, error)
}

BlockIndexer interface defines methods to index and search blocks.

type IndexerService

type IndexerService struct {
	cmn.BaseService
	// contains filtered or unexported fields
}

IndexerService connects event bus and block indexer together in order to index blocks coming from event bus.

func NewIndexerService

func NewIndexerService(idr BlockIndexer, eventBus *types.EventBus) *IndexerService

NewIndexerService returns a new service instance.

func (*IndexerService) OnStart

func (is *IndexerService) OnStart() error

OnStart implements cmn.Service by subscribing for blocks and indexing them by hash.

func (*IndexerService) OnStop

func (is *IndexerService) OnStop()

OnStop implements cmn.Service by unsubscribing from blocks.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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