Documentation ¶
Index ¶
- Variables
- func GetDataEntry(batch *database.Batch, txnHash []byte) (protocol.DataEntry, error)
- func LoadIndexEntryFromEnd(c *database.Chain2, offset uint64) (*protocol.IndexEntry, error)
- func LoadLastTwoIndexEntries(chain *database.Chain2) (last, nextLast *protocol.IndexEntry, err error)
- func ReceiptForAccountState(net *config.Describe, batch *database.Batch, account *database.Account) (block uint64, receipt *managed.Receipt, err error)
- func ReceiptForChainEntry(net *config.Describe, batch *database.Batch, account *database.Account, ...) (uint64, *managed.Receipt, error)
- func ReceiptForChainIndex(net *config.Describe, batch *database.Batch, c *database.Chain2, index int64) (uint64, *managed.Receipt, error)
- func SearchIndexChain(chain *database.Chain, index uint64, mode MatchMode, ...) (uint64, *protocol.IndexEntry, error)
- type BlockChainUpdatesIndexer
- type BlockStateIndexer
- type DataIndexer
- func (d *DataIndexer) Count() (uint64, error)
- func (d *DataIndexer) Entry(i uint64) ([]byte, error)
- func (d *DataIndexer) GetLatest() (index uint64, entryHash, txnHash []byte, err error)
- func (d *DataIndexer) GetLatestEntry() (protocol.DataEntry, error)
- func (d *DataIndexer) Put(entryHash, txnHash []byte) error
- func (d *DataIndexer) Transaction(entryHash []byte) ([]byte, error)
- type DirectoryIndexer
- type IndexChainSearchFunction
- type MatchMode
- type SearchDirection
- type TransactionChainIndexer
Constants ¶
This section is empty.
Variables ¶
var ErrReachedChainEnd = errors.New("reached the end of the chain")
var ErrReachedChainStart = errors.New("reached the start of the chain")
Functions ¶
func GetDataEntry ¶ added in v1.0.0
func LoadIndexEntryFromEnd ¶ added in v0.6.0
LoadIndexEntryFromEnd loads the Nth-to-last entry from an index chain. LoadIndexEntryFromEnd will panic if the offset is zero. If the offset is greater than the chain height, LoadIndexEntryFromEnd returns nil, nil.
func LoadLastTwoIndexEntries ¶ added in v0.6.0
func LoadLastTwoIndexEntries(chain *database.Chain2) (last, nextLast *protocol.IndexEntry, err error)
LoadLastTwoIndexEntries loads the last and next to last entries of the index chain.
func ReceiptForAccountState ¶ added in v0.6.0
func ReceiptForChainEntry ¶ added in v0.6.0
func ReceiptForChainIndex ¶ added in v0.6.0
func SearchIndexChain ¶ added in v0.5.1
func SearchIndexChain(chain *database.Chain, index uint64, mode MatchMode, find IndexChainSearchFunction) (uint64, *protocol.IndexEntry, error)
SearchIndexChain searches along an index chain using the given search function. The search starts from the given index and proceeds forwards or backwards along the chain depending on the result of the search function.
Types ¶
type BlockChainUpdatesIndexer ¶ added in v0.6.0
type BlockChainUpdatesIndexer struct { *record.List[*database.ChainUpdate] }
BlockChainUpdatesIndexer indexes chain updates for each block.
func BlockChainUpdates ¶ added in v0.6.0
func BlockChainUpdates(batch *database.Batch, network *config.Describe, blockIndex uint64) *BlockChainUpdatesIndexer
BlockChainUpdates returns a block updates indexer.
func (*BlockChainUpdatesIndexer) Set ¶ added in v0.6.0
func (x *BlockChainUpdatesIndexer) Set(entries []database.ChainUpdate) error
type BlockStateIndexer ¶
type BlockStateIndexer struct { *record.Set[*database.BlockStateSynthTxnEntry] }
BlockStateIndexer tracks transient state for a block.
func BlockState ¶
func BlockState(batch *database.Batch, ledger *url.URL) *BlockStateIndexer
BlockState returns a block state indexer.
func (*BlockStateIndexer) Clear ¶
func (x *BlockStateIndexer) Clear() error
Clear resets the block state.
func (*BlockStateIndexer) DidProduceSynthTxn ¶
func (x *BlockStateIndexer) DidProduceSynthTxn(entry *database.BlockStateSynthTxnEntry) error
DidProduceSynthTxn records a produced synthetic transaction.
type DataIndexer ¶ added in v1.0.0
type DataIndexer struct { *database.AccountData // contains filtered or unexported fields }
func (*DataIndexer) Count ¶ added in v1.0.0
func (d *DataIndexer) Count() (uint64, error)
func (*DataIndexer) Entry ¶ added in v1.0.0
func (d *DataIndexer) Entry(i uint64) ([]byte, error)
Entry returns the entry hash for the given index.
func (*DataIndexer) GetLatest ¶ added in v1.0.0
func (d *DataIndexer) GetLatest() (index uint64, entryHash, txnHash []byte, err error)
GetLatest returns the last entry.
func (*DataIndexer) GetLatestEntry ¶ added in v1.0.0
func (d *DataIndexer) GetLatestEntry() (protocol.DataEntry, error)
func (*DataIndexer) Put ¶ added in v1.0.0
func (d *DataIndexer) Put(entryHash, txnHash []byte) error
func (*DataIndexer) Transaction ¶ added in v1.0.0
func (d *DataIndexer) Transaction(entryHash []byte) ([]byte, error)
Transaction returns the transaction hash for the given entry hash.
type DirectoryIndexer ¶ added in v1.0.0
func Directory ¶ added in v0.6.0
func Directory(batch *database.Batch, account *url.URL) *DirectoryIndexer
func (*DirectoryIndexer) Count ¶ added in v1.0.0
func (d *DirectoryIndexer) Count() (uint64, error)
type IndexChainSearchFunction ¶ added in v0.5.1
type IndexChainSearchFunction func(*protocol.IndexEntry) SearchDirection
IndexChainSearchFunction determines the direction an index chain search should proceed.
func SearchIndexChainByAnchorBounds ¶ added in v0.5.1
func SearchIndexChainByAnchorBounds(lowerBound, upperBound uint64) IndexChainSearchFunction
SearchIndexChainByAnchorBounds returns a search function that searches an index chain for an entry with an anchor in the given bounds (inclusive).
func SearchIndexChainByBlock ¶ added in v0.5.1
func SearchIndexChainByBlock(blockIndex uint64) IndexChainSearchFunction
SearchIndexChainByBlock returns a search function that searches an index chain for the given block index.
func SearchIndexChainBySource ¶ added in v0.5.1
func SearchIndexChainBySource(targetSource uint64) IndexChainSearchFunction
SearchIndexChainBySource returns a search function that searches an index chain for the given source.
type MatchMode ¶ added in v0.5.1
type MatchMode int
MatchMode determines how results are returned from a search.
type SearchDirection ¶ added in v0.5.1
type SearchDirection int
SearchDirection represents a direction to search along a linear index.
const ( // SearchComplete is returned when the search is complete. SearchComplete SearchDirection = iota // SearchForward is returned when the search should proceed forwards along // the index. SearchForward // SearchBackward is returned when the search should proceed backwards along // the index. SearchBackward )
type TransactionChainIndexer ¶
type TransactionChainIndexer struct { *record.Set[*database.TransactionChainEntry] }
TransactionChainIndexer indexes account chains against a transaction.
func TransactionChain ¶
func TransactionChain(batch *database.Batch, txid []byte) *TransactionChainIndexer
TransactionChain returns a transaction chain indexer.