txindex

package
v0.18.0-autodraft Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorEmptyHash = errors.New("Transaction hash cannot be empty")

ErrorEmptyHash indicates empty hash

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Ops []*types.TxResult
}

Batch groups together multiple Index operations to be performed at the same time. NOTE: Batch is NOT thread-safe and must not be modified after starting its execution.

func NewBatch

func NewBatch(n int) *Batch

NewBatch creates a new Batch.

func (*Batch) Add

func (b *Batch) Add(result *types.TxResult) error

Add or update an entry for the given result.Index.

func (*Batch) Size

func (b *Batch) Size() int

Size returns the total number of operations inside the batch.

type IndexerService

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

func NewIndexerService

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

func (*IndexerService) OnStart

func (is *IndexerService) OnStart() error

OnStart implements cmn.Service by subscribing for all transactions and indexing them by tags.

func (*IndexerService) OnStop

func (is *IndexerService) OnStop()

OnStop implements cmn.Service by unsubscribing from all transactions.

type TxIndexer

type TxIndexer interface {

	// AddBatch analyzes, indexes and stores a batch of transactions.
	AddBatch(b *Batch) error

	// Index analyzes, indexes and stores a single transaction.
	Index(result *types.TxResult) error

	// Get returns the transaction specified by hash or nil if the transaction is not indexed
	// or stored.
	Get(hash []byte) (*types.TxResult, error)

	// Search allows you to query for transactions.
	Search(q *query.Query) ([]*types.TxResult, error)
}

TxIndexer interface defines methods to index and search transactions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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