Documentation ¶
Index ¶
- Variables
- func SearchIndexChain(chain *database.Chain, index uint64, find IndexChainSearchFunction) (uint64, *protocol.IndexEntry, error)
- type BlockStateIndex
- func (v *BlockStateIndex) Copy() *BlockStateIndex
- func (v *BlockStateIndex) CopyAsInterface() interface{}
- func (v *BlockStateIndex) Equal(u *BlockStateIndex) bool
- func (v *BlockStateIndex) IsValid() error
- func (v *BlockStateIndex) MarshalBinary() ([]byte, error)
- func (v *BlockStateIndex) UnmarshalBinary(data []byte) error
- func (v *BlockStateIndex) UnmarshalBinaryFrom(rd io.Reader) error
- type BlockStateIndexer
- type BlockStateSynthTxnEntry
- func (v *BlockStateSynthTxnEntry) Copy() *BlockStateSynthTxnEntry
- func (v *BlockStateSynthTxnEntry) CopyAsInterface() interface{}
- func (v *BlockStateSynthTxnEntry) Equal(u *BlockStateSynthTxnEntry) bool
- func (v *BlockStateSynthTxnEntry) IsValid() error
- func (v *BlockStateSynthTxnEntry) MarshalBinary() ([]byte, error)
- func (v *BlockStateSynthTxnEntry) MarshalJSON() ([]byte, error)
- func (v *BlockStateSynthTxnEntry) UnmarshalBinary(data []byte) error
- func (v *BlockStateSynthTxnEntry) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *BlockStateSynthTxnEntry) UnmarshalJSON(data []byte) error
- type IndexChainSearchFunction
- type PendingTransactionsIndex
- func (v *PendingTransactionsIndex) Copy() *PendingTransactionsIndex
- func (v *PendingTransactionsIndex) CopyAsInterface() interface{}
- func (v *PendingTransactionsIndex) Equal(u *PendingTransactionsIndex) bool
- func (v *PendingTransactionsIndex) IsValid() error
- func (v *PendingTransactionsIndex) MarshalBinary() ([]byte, error)
- func (v *PendingTransactionsIndex) MarshalJSON() ([]byte, error)
- func (v *PendingTransactionsIndex) UnmarshalBinary(data []byte) error
- func (v *PendingTransactionsIndex) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *PendingTransactionsIndex) UnmarshalJSON(data []byte) error
- type PendingTransactionsIndexer
- type SearchDirection
- type TransactionChainEntry
- func (v *TransactionChainEntry) Copy() *TransactionChainEntry
- func (v *TransactionChainEntry) CopyAsInterface() interface{}
- func (v *TransactionChainEntry) Equal(u *TransactionChainEntry) bool
- func (v *TransactionChainEntry) IsValid() error
- func (v *TransactionChainEntry) MarshalBinary() ([]byte, error)
- func (v *TransactionChainEntry) UnmarshalBinary(data []byte) error
- func (v *TransactionChainEntry) UnmarshalBinaryFrom(rd io.Reader) error
- type TransactionChainIndex
- func (v *TransactionChainIndex) Copy() *TransactionChainIndex
- func (v *TransactionChainIndex) CopyAsInterface() interface{}
- func (v *TransactionChainIndex) Equal(u *TransactionChainIndex) bool
- func (v *TransactionChainIndex) IsValid() error
- func (v *TransactionChainIndex) MarshalBinary() ([]byte, error)
- func (v *TransactionChainIndex) UnmarshalBinary(data []byte) error
- func (v *TransactionChainIndex) UnmarshalBinaryFrom(rd io.Reader) error
- 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 SearchIndexChain ¶ added in v0.5.1
func SearchIndexChain(chain *database.Chain, index uint64, 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 BlockStateIndex ¶
type BlockStateIndex struct { ProducedSynthTxns []*BlockStateSynthTxnEntry `json:"producedSynthTxns,omitempty" form:"producedSynthTxns" query:"producedSynthTxns" validate:"required"` // contains filtered or unexported fields }
func (*BlockStateIndex) Copy ¶ added in v0.5.1
func (v *BlockStateIndex) Copy() *BlockStateIndex
func (*BlockStateIndex) CopyAsInterface ¶ added in v0.5.1
func (v *BlockStateIndex) CopyAsInterface() interface{}
func (*BlockStateIndex) Equal ¶
func (v *BlockStateIndex) Equal(u *BlockStateIndex) bool
func (*BlockStateIndex) IsValid ¶
func (v *BlockStateIndex) IsValid() error
func (*BlockStateIndex) MarshalBinary ¶
func (v *BlockStateIndex) MarshalBinary() ([]byte, error)
func (*BlockStateIndex) UnmarshalBinary ¶
func (v *BlockStateIndex) UnmarshalBinary(data []byte) error
func (*BlockStateIndex) UnmarshalBinaryFrom ¶
func (v *BlockStateIndex) UnmarshalBinaryFrom(rd io.Reader) error
type BlockStateIndexer ¶
type BlockStateIndexer struct {
// contains filtered or unexported fields
}
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 *BlockStateSynthTxnEntry) error
DidProduceSynthTxn records a produced synthetic transaction.
func (*BlockStateIndexer) Get ¶
func (x *BlockStateIndexer) Get() (*BlockStateIndex, error)
Get loads the block state.
type BlockStateSynthTxnEntry ¶
type BlockStateSynthTxnEntry struct { Transaction []byte `json:"transaction,omitempty" form:"transaction" query:"transaction" validate:"required"` ChainEntry uint64 `json:"chainEntry,omitempty" form:"chainEntry" query:"chainEntry" validate:"required"` // contains filtered or unexported fields }
func (*BlockStateSynthTxnEntry) Copy ¶ added in v0.5.1
func (v *BlockStateSynthTxnEntry) Copy() *BlockStateSynthTxnEntry
func (*BlockStateSynthTxnEntry) CopyAsInterface ¶ added in v0.5.1
func (v *BlockStateSynthTxnEntry) CopyAsInterface() interface{}
func (*BlockStateSynthTxnEntry) Equal ¶
func (v *BlockStateSynthTxnEntry) Equal(u *BlockStateSynthTxnEntry) bool
func (*BlockStateSynthTxnEntry) IsValid ¶
func (v *BlockStateSynthTxnEntry) IsValid() error
func (*BlockStateSynthTxnEntry) MarshalBinary ¶
func (v *BlockStateSynthTxnEntry) MarshalBinary() ([]byte, error)
func (*BlockStateSynthTxnEntry) MarshalJSON ¶
func (v *BlockStateSynthTxnEntry) MarshalJSON() ([]byte, error)
func (*BlockStateSynthTxnEntry) UnmarshalBinary ¶
func (v *BlockStateSynthTxnEntry) UnmarshalBinary(data []byte) error
func (*BlockStateSynthTxnEntry) UnmarshalBinaryFrom ¶
func (v *BlockStateSynthTxnEntry) UnmarshalBinaryFrom(rd io.Reader) error
func (*BlockStateSynthTxnEntry) UnmarshalJSON ¶
func (v *BlockStateSynthTxnEntry) UnmarshalJSON(data []byte) 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.
type PendingTransactionsIndex ¶
type PendingTransactionsIndex struct { Transactions [][32]byte `json:"transactions,omitempty" form:"transactions" query:"transactions" validate:"required"` // contains filtered or unexported fields }
func (*PendingTransactionsIndex) Copy ¶ added in v0.5.1
func (v *PendingTransactionsIndex) Copy() *PendingTransactionsIndex
func (*PendingTransactionsIndex) CopyAsInterface ¶ added in v0.5.1
func (v *PendingTransactionsIndex) CopyAsInterface() interface{}
func (*PendingTransactionsIndex) Equal ¶
func (v *PendingTransactionsIndex) Equal(u *PendingTransactionsIndex) bool
func (*PendingTransactionsIndex) IsValid ¶
func (v *PendingTransactionsIndex) IsValid() error
func (*PendingTransactionsIndex) MarshalBinary ¶
func (v *PendingTransactionsIndex) MarshalBinary() ([]byte, error)
func (*PendingTransactionsIndex) MarshalJSON ¶
func (v *PendingTransactionsIndex) MarshalJSON() ([]byte, error)
func (*PendingTransactionsIndex) UnmarshalBinary ¶
func (v *PendingTransactionsIndex) UnmarshalBinary(data []byte) error
func (*PendingTransactionsIndex) UnmarshalBinaryFrom ¶
func (v *PendingTransactionsIndex) UnmarshalBinaryFrom(rd io.Reader) error
func (*PendingTransactionsIndex) UnmarshalJSON ¶
func (v *PendingTransactionsIndex) UnmarshalJSON(data []byte) error
type PendingTransactionsIndexer ¶
type PendingTransactionsIndexer struct {
// contains filtered or unexported fields
}
PendingTransactionsIndexer indexes pending transactions of an account.
func PendingTransactions ¶
func PendingTransactions(batch *database.Batch, account *url.URL) *PendingTransactionsIndexer
PendingTransactions returns a pending transactions indexer.
func (*PendingTransactionsIndexer) Add ¶
func (x *PendingTransactionsIndexer) Add(txid [32]byte) error
Add adds a transaction to the list of pending transactions, if it is not already on the list.
func (*PendingTransactionsIndexer) Get ¶
func (x *PendingTransactionsIndexer) Get() ([][32]byte, error)
Get loads the list of pending transactions.
func (*PendingTransactionsIndexer) Remove ¶
func (x *PendingTransactionsIndexer) Remove(txid [32]byte) error
Remove removes a transaction from the list of pending transactions, if it is on the list.
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 TransactionChainEntry ¶
type TransactionChainEntry struct { Account *url.URL `json:"account,omitempty" form:"account" query:"account" validate:"required"` // Chain is the name of the chain. Chain string `json:"chain,omitempty" form:"chain" query:"chain" validate:"required"` // ChainIndex is the index of the entry in the chain's index chain. ChainIndex uint64 `json:"chainIndex,omitempty" form:"chainIndex" query:"chainIndex" validate:"required"` // AnchorIndex is the index of the entry in the anchor chain's index chain. AnchorIndex uint64 `json:"anchorIndex,omitempty" form:"anchorIndex" query:"anchorIndex" validate:"required"` // contains filtered or unexported fields }
func (*TransactionChainEntry) Copy ¶ added in v0.5.1
func (v *TransactionChainEntry) Copy() *TransactionChainEntry
func (*TransactionChainEntry) CopyAsInterface ¶ added in v0.5.1
func (v *TransactionChainEntry) CopyAsInterface() interface{}
func (*TransactionChainEntry) Equal ¶
func (v *TransactionChainEntry) Equal(u *TransactionChainEntry) bool
func (*TransactionChainEntry) IsValid ¶
func (v *TransactionChainEntry) IsValid() error
func (*TransactionChainEntry) MarshalBinary ¶
func (v *TransactionChainEntry) MarshalBinary() ([]byte, error)
func (*TransactionChainEntry) UnmarshalBinary ¶
func (v *TransactionChainEntry) UnmarshalBinary(data []byte) error
func (*TransactionChainEntry) UnmarshalBinaryFrom ¶
func (v *TransactionChainEntry) UnmarshalBinaryFrom(rd io.Reader) error
type TransactionChainIndex ¶
type TransactionChainIndex struct { Entries []*TransactionChainEntry `json:"entries,omitempty" form:"entries" query:"entries" validate:"required"` // contains filtered or unexported fields }
func (*TransactionChainIndex) Copy ¶ added in v0.5.1
func (v *TransactionChainIndex) Copy() *TransactionChainIndex
func (*TransactionChainIndex) CopyAsInterface ¶ added in v0.5.1
func (v *TransactionChainIndex) CopyAsInterface() interface{}
func (*TransactionChainIndex) Equal ¶
func (v *TransactionChainIndex) Equal(u *TransactionChainIndex) bool
func (*TransactionChainIndex) IsValid ¶
func (v *TransactionChainIndex) IsValid() error
func (*TransactionChainIndex) MarshalBinary ¶
func (v *TransactionChainIndex) MarshalBinary() ([]byte, error)
func (*TransactionChainIndex) UnmarshalBinary ¶
func (v *TransactionChainIndex) UnmarshalBinary(data []byte) error
func (*TransactionChainIndex) UnmarshalBinaryFrom ¶
func (v *TransactionChainIndex) UnmarshalBinaryFrom(rd io.Reader) error
type TransactionChainIndexer ¶
type TransactionChainIndexer struct {
// contains filtered or unexported fields
}
TransactionChainIndexer indexes account chains against a transaction.
func TransactionChain ¶
func TransactionChain(batch *database.Batch, txid []byte) *TransactionChainIndexer
TransactionChain returns a transaction chain indexer.
func (*TransactionChainIndexer) Add ¶
func (t *TransactionChainIndexer) Add(entry *TransactionChainEntry) error
Add adds a new entry to the index.
func (*TransactionChainIndexer) Get ¶
func (t *TransactionChainIndexer) Get() (*TransactionChainIndex, error)
Get loads and unmarshals the index. Get returns an empty index if it has not been defined.