kv

package
v0.0.0-sei-fork Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyFromHeight

func KeyFromHeight(result *abci.TxResult) []byte

Types

type TxIndex

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

TxIndex is the simplest possible indexer It is backed by two kv stores: 1. txhash - result (primary key) 2. event - txhash (secondary key)

func NewTxIndex

func NewTxIndex(store dbm.DB) *TxIndex

NewTxIndex creates new KV indexer.

func (*TxIndex) AddBatch

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

func (*TxIndex) Get

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

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

func (*TxIndex) Index

func (txi *TxIndex) Index(results []*abci.TxResult) error

Index indexes transactions using the given list of events. Each key that indexed from the tx's events is a composite of the event type and the respective attribute's key delimited by a "." (eg. "account.number"). Any event with an empty type is not indexed.

func (*TxIndex) Search

func (txi *TxIndex) Search(ctx context.Context, q *query.Query) ([]*abci.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, in no particular order.

Search will exit early and return any result fetched so far, when a message is received on the context chan.

Jump to

Keyboard shortcuts

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