Documentation ¶
Index ¶
- Variables
- func GetDataEntry(batch *database.Batch, txnHash []byte) (protocol.DataEntry, *url.TxID, *url.TxID, error)
- func LoadIndexEntryFromEnd(c *database.Chain2, offset uint64) (*protocol.IndexEntry, error)
- func LoadLastTwoIndexEntries(chain *database.Chain2) (last, nextLast *protocol.IndexEntry, err error)
- func ReceiptForAccountState(partition config.NetworkUrl, batch *database.Batch, account *database.Account) (block *protocol.IndexEntry, receipt *merkle.Receipt, err error)
- func ReceiptForChainEntry(net *config.Describe, batch *database.Batch, account *database.Account, ...) (*protocol.IndexEntry, *merkle.Receipt, error)
- func ReceiptForChainIndex(partition config.NetworkUrl, batch *database.Batch, c *database.Chain2, ...) (*protocol.IndexEntry, uint64, *merkle.Receipt, error)
- func SearchIndexChain(chain *database.Chain, index uint64, mode MatchMode, ...) (uint64, *protocol.IndexEntry, error)
- func SearchIndexChain2(chain *database.Chain2, index uint64, mode MatchMode, ...) (uint64, *protocol.IndexEntry, error)
- 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, *url.TxID, *url.TxID, error)
- func (d *DataIndexer) Put(entryHash, txnHash []byte) error
- func (d *DataIndexer) Transaction(entryHash []byte) ([]byte, error)
- type DirectoryIndexer
- type IndexChainSearchFunction
- func SearchIndexChainByAnchorBounds(lowerBound, upperBound uint64) IndexChainSearchFunction
- func SearchIndexChainByBlock(blockIndex uint64) IndexChainSearchFunction
- func SearchIndexChainByRootIndexIndex(targetRootIndexIndex uint64) IndexChainSearchFunction
- func SearchIndexChainBySource(targetSource uint64) IndexChainSearchFunction
- type MatchMode
- type SearchDirection
- type TransactionChainIndexer
Constants ¶
This section is empty.
Variables ¶
var ErrReachedChainEnd = errors.NotFound.With("reached the end of the chain")
var ErrReachedChainStart = errors.NotFound.With("reached the start of the chain")
var ErrTargetDoesNotExist = errors.NotFound.With("target does not exist")
Functions ¶
func GetDataEntry ¶
func LoadIndexEntryFromEnd ¶
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 ¶
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 ¶
func ReceiptForChainEntry ¶
func ReceiptForChainIndex ¶
func SearchIndexChain ¶
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.
func SearchIndexChain2 ¶ added in v1.2.10
func SearchIndexChain2(chain *database.Chain2, index uint64, mode MatchMode, find IndexChainSearchFunction) (uint64, *protocol.IndexEntry, error)
SearchIndexChain2 is a wrapper for SearchIndexChain that accepts database.Chain2.
Types ¶
type DataIndexer ¶
type DataIndexer struct { *database.AccountData // contains filtered or unexported fields }
func (*DataIndexer) Count ¶
func (d *DataIndexer) Count() (uint64, error)
func (*DataIndexer) Entry ¶
func (d *DataIndexer) Entry(i uint64) ([]byte, error)
Entry returns the entry hash for the given index.
func (*DataIndexer) GetLatest ¶
func (d *DataIndexer) GetLatest() (index uint64, entryHash, txnHash []byte, err error)
GetLatest returns the last entry.
func (*DataIndexer) GetLatestEntry ¶
func (*DataIndexer) Put ¶
func (d *DataIndexer) Put(entryHash, txnHash []byte) error
func (*DataIndexer) Transaction ¶
func (d *DataIndexer) Transaction(entryHash []byte) ([]byte, error)
Transaction returns the transaction hash for the given entry hash.
type DirectoryIndexer ¶
func (*DirectoryIndexer) Count ¶
func (d *DirectoryIndexer) Count() (uint64, error)
type IndexChainSearchFunction ¶
type IndexChainSearchFunction func(*protocol.IndexEntry) SearchDirection
IndexChainSearchFunction determines the direction an index chain search should proceed.
func SearchIndexChainByAnchorBounds ¶
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 ¶
func SearchIndexChainByBlock(blockIndex uint64) IndexChainSearchFunction
SearchIndexChainByBlock returns a search function that searches an index chain for the given block index.
func SearchIndexChainByRootIndexIndex ¶
func SearchIndexChainByRootIndexIndex(targetRootIndexIndex uint64) IndexChainSearchFunction
SearchIndexChainByRootIndexIndex returns a search function that searches an index chain for the given RootIndexIndex.
func SearchIndexChainBySource ¶
func SearchIndexChainBySource(targetSource uint64) IndexChainSearchFunction
SearchIndexChainBySource returns a search function that searches an index chain for the given source.
type SearchDirection ¶
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 { values.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.