Documentation ¶
Index ¶
- Variables
- func ParseEventSeqFromEventKey(key []byte) (int64, error)
- type HeightInfo
- type IndexerOption
- type TxIndex
- func (txi *TxIndex) AddBatch(b *txindex.Batch) error
- func (txi *TxIndex) Get(hash []byte) (*abci.TxResult, error)
- func (txi *TxIndex) GetRetainHeight() (int64, error)
- func (txi *TxIndex) Index(result *abci.TxResult) error
- func (txi *TxIndex) Prune(retainHeight int64) (numPruned int64, newRetainHeight int64, err error)
- func (txi *TxIndex) Search(ctx context.Context, q *query.Query, pagSettings txindex.Pagination) ([]*abci.TxResult, int, error)
- func (txi *TxIndex) SetLogger(l log.Logger)
- func (txi *TxIndex) SetRetainHeight(retainHeight int64) error
- type TxInfo
- type TxResultByHeight
Constants ¶
This section is empty.
Variables ¶
var ( LastTxIndexerRetainHeightKey = []byte("LastTxIndexerRetainHeightKey") TxIndexerRetainHeightKey = []byte("TxIndexerRetainHeightKey") )
Functions ¶
Types ¶
type HeightInfo ¶
type HeightInfo struct {
// contains filtered or unexported fields
}
type IndexerOption ¶
type IndexerOption func(*TxIndex)
func WithCompaction ¶
func WithCompaction(compact bool, compactionInterval int64) IndexerOption
WithCompaction sets the compaciton parameters.
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 ...IndexerOption) *TxIndex
NewTxIndex creates new KV indexer.
func (*TxIndex) AddBatch ¶
AddBatch indexes a batch of 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) Get ¶
Get gets transaction from the TxIndex storage and returns it or nil if the transaction is not found.
func (*TxIndex) GetRetainHeight ¶
func (*TxIndex) Index ¶
Index indexes a single transaction 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.
If a transaction is indexed with the same hash as a previous transaction, it will be overwritten unless the tx result was NOT OK and the prior result was OK i.e. more transactions that successfully executed overwrite transactions that failed or successful yet older transactions.
func (*TxIndex) Search ¶
func (txi *TxIndex) Search(ctx context.Context, q *query.Query, pagSettings txindex.Pagination) ([]*abci.TxResult, int, 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.
func (*TxIndex) SetRetainHeight ¶
type TxResultByHeight ¶
func (TxResultByHeight) Len ¶
func (a TxResultByHeight) Len() int
func (TxResultByHeight) Less ¶
func (a TxResultByHeight) Less(i, j int) bool
func (TxResultByHeight) Swap ¶
func (a TxResultByHeight) Swap(i, j int)