blockindex

package
v0.31.5-binance.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

func (*IndexerService) SetOnIndex

func (is *IndexerService) SetOnIndex(callback func(int64))

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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