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(net *config.Describe, batch *database.Batch, account *database.Account) (block *protocol.IndexEntry, receipt *managed.Receipt, err error)
- func ReceiptForChainEntry(net *config.Describe, batch *database.Batch, account *database.Account, ...) (*protocol.IndexEntry, *managed.Receipt, error)
- func ReceiptForChainIndex(net *config.Describe, batch *database.Batch, c *database.Chain2, index int64) (*protocol.IndexEntry, *managed.Receipt, error)
- func SearchIndexChain(chain *database.Chain, 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.New(errors.StatusNotFound, "reached the end of the chain")
var ErrReachedChainStart = errors.New(errors.StatusNotFound, "reached the start of the chain")
var ErrTargetDoesNotExist = errors.New(errors.StatusNotFound, "target does not exist")
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 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 (*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 SearchIndexChainByRootIndexIndex ¶ added in v1.0.0
func SearchIndexChainByRootIndexIndex(targetRootIndexIndex uint64) IndexChainSearchFunction
SearchIndexChainByRootIndexIndex returns a search function that searches an index chain for the given RootIndexIndex.
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.