kv

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CounterTxsKey  = "countTxs"
	CounterPodsKey = "countPods"
)

Variables

This section is empty.

Functions

func GetNonce

func GetNonce(txStore *TxIndex, address string) (uint64, error)

GetNonce retrieves the nonce for a given address. if not exists 0

func GetPod

func GetPod(txStore *TxIndex, podNumber int) ([][]byte, error)

GetPod retrieves and deserializes a pod of transactions

func IncrementPodCount

func IncrementPodCount(txi *TxIndex) error

func IncrementTxCount

func IncrementTxCount(txi *TxIndex) error

func InitiateDatabaseForPods

func InitiateDatabaseForPods(txi *TxIndex) error

func ParseEventSeqFromEventKey

func ParseEventSeqFromEventKey(key []byte) (int64, error)

func RetrievePodCount

func RetrievePodCount(txStore *TxIndex) (int, error)

func RetrieveTxCount

func RetrieveTxCount(txStore *TxIndex) (int, error)

func SetNonce

func SetNonce(txStore *TxIndex, address string, nonce uint64) error

SetNonce stores the nonce for a given address

func SetPod

func SetPod(txStore *TxIndex, podNumber int, pod [][]byte) error

SetPod stores a pod of transactions as a single byte slice

func SetTxCount

func SetTxCount(txStore *TxIndex, count int) error

func StorePod

func StorePod(txi *TxIndex, b *txindex.Batch) error

Types

type HeightInfo

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

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) *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 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) AddPod

func (txi *TxIndex) AddPod(b *txindex.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) GetbytedataFortracks

func (txi *TxIndex) GetbytedataFortracks(hash []byte) ([]byte, error)

func (*TxIndex) Index

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

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) ([]*abci.TxResult, error)

Search performs a search using the given query.

func (*TxIndex) SetLogger

func (txi *TxIndex) SetLogger(l log.Logger)

Jump to

Keyboard shortcuts

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