kv

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexAllTags added in v0.13.0

func IndexAllTags() func(*TxIndex)

IndexAllTags is an option for indexing all tags.

func IndexTags added in v0.13.0

func IndexTags(tags []string) func(*TxIndex)

IndexTags is an option for setting which tags to index.

Types

type TxIndex

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

TxIndex is the simplest possible indexer, backed by key-value storage (levelDB).

func NewTxIndex

func NewTxIndex(store dbm.DB, options ...func(*TxIndex)) *TxIndex

NewTxIndex creates new KV indexer.

func (*TxIndex) AddBatch

func (txi *TxIndex) AddBatch(b *txindex.Batch) error

AddBatch indexes a batch of transactions using the given list of tags.

func (*TxIndex) Get

func (txi *TxIndex) Get(hash []byte) (*types.TxResult, error)

Get gets transaction from the TxIndex storage and returns it or nil if the transaction is not found.

func (*TxIndex) Index added in v0.13.0

func (txi *TxIndex) Index(result *types.TxResult) error

Index indexes a single transaction using the given list of tags.

func (*TxIndex) Search added in v0.13.0

func (txi *TxIndex) Search(q *query.Query) ([]*types.TxResult, error)

Search performs a search using the given query. It breaks the query into conditions (like "tx.height > 5"). For each condition, it queries the DB index. One special use cases here: (1) if "tx.hash" is found, it returns tx result for it (2) for range queries it is better for the client to provide both lower and upper bounds, so we are not performing a full scan. Results from querying indexes are then intersected and returned to the caller.

Jump to

Keyboard shortcuts

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