Documentation ¶
Index ¶
- Variables
- func ReceiptForAccountState(net *config.Network, batch *Batch, account *Account) (block uint64, receipt *managed.Receipt, err error)
- func ReceiptForChainEntry(net *config.Network, batch *Batch, account *Account, hash []byte, ...) (uint64, *managed.Receipt, error)
- func ReceiptForChainIndex(net *config.Network, batch *Batch, account *Account, name string, index int64) (uint64, *managed.Receipt, error)
- func SearchIndexChain(chain *database.Chain, index uint64, mode MatchMode, ...) (uint64, *protocol.IndexEntry, error)
- type BlockChainUpdatesIndex
- func (v *BlockChainUpdatesIndex) Copy() *BlockChainUpdatesIndex
- func (v *BlockChainUpdatesIndex) CopyAsInterface() interface{}
- func (v *BlockChainUpdatesIndex) Equal(u *BlockChainUpdatesIndex) bool
- func (v *BlockChainUpdatesIndex) IsValid() error
- func (v *BlockChainUpdatesIndex) MarshalBinary() ([]byte, error)
- func (v *BlockChainUpdatesIndex) MarshalJSON() ([]byte, error)
- func (v *BlockChainUpdatesIndex) UnmarshalBinary(data []byte) error
- func (v *BlockChainUpdatesIndex) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *BlockChainUpdatesIndex) UnmarshalJSON(data []byte) error
- type BlockChainUpdatesIndexer
- 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) MarshalJSON() ([]byte, error)
- func (v *BlockStateIndex) UnmarshalBinary(data []byte) error
- func (v *BlockStateIndex) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *BlockStateIndex) UnmarshalJSON(data []byte) 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 ChainUpdate
- func (v *ChainUpdate) Copy() *ChainUpdate
- func (v *ChainUpdate) CopyAsInterface() interface{}
- func (v *ChainUpdate) Equal(u *ChainUpdate) bool
- func (v *ChainUpdate) IsValid() error
- func (v *ChainUpdate) MarshalBinary() ([]byte, error)
- func (v *ChainUpdate) MarshalJSON() ([]byte, error)
- func (v *ChainUpdate) UnmarshalBinary(data []byte) error
- func (v *ChainUpdate) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *ChainUpdate) UnmarshalJSON(data []byte) error
- type DirectoryIndex
- type IndexChainSearchFunction
- type MatchMode
- 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) MarshalJSON() ([]byte, error)
- func (v *TransactionChainIndex) UnmarshalBinary(data []byte) error
- func (v *TransactionChainIndex) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *TransactionChainIndex) UnmarshalJSON(data []byte) 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 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 BlockChainUpdatesIndex ¶ added in v0.6.0
type BlockChainUpdatesIndex struct { Entries []*ChainUpdate `json:"entries,omitempty" form:"entries" query:"entries" validate:"required"` // contains filtered or unexported fields }
func (*BlockChainUpdatesIndex) Copy ¶ added in v0.6.0
func (v *BlockChainUpdatesIndex) Copy() *BlockChainUpdatesIndex
func (*BlockChainUpdatesIndex) CopyAsInterface ¶ added in v0.6.0
func (v *BlockChainUpdatesIndex) CopyAsInterface() interface{}
func (*BlockChainUpdatesIndex) Equal ¶ added in v0.6.0
func (v *BlockChainUpdatesIndex) Equal(u *BlockChainUpdatesIndex) bool
func (*BlockChainUpdatesIndex) IsValid ¶ added in v0.6.0
func (v *BlockChainUpdatesIndex) IsValid() error
func (*BlockChainUpdatesIndex) MarshalBinary ¶ added in v0.6.0
func (v *BlockChainUpdatesIndex) MarshalBinary() ([]byte, error)
func (*BlockChainUpdatesIndex) MarshalJSON ¶ added in v0.6.0
func (v *BlockChainUpdatesIndex) MarshalJSON() ([]byte, error)
func (*BlockChainUpdatesIndex) UnmarshalBinary ¶ added in v0.6.0
func (v *BlockChainUpdatesIndex) UnmarshalBinary(data []byte) error
func (*BlockChainUpdatesIndex) UnmarshalBinaryFrom ¶ added in v0.6.0
func (v *BlockChainUpdatesIndex) UnmarshalBinaryFrom(rd io.Reader) error
func (*BlockChainUpdatesIndex) UnmarshalJSON ¶ added in v0.6.0
func (v *BlockChainUpdatesIndex) UnmarshalJSON(data []byte) error
type BlockChainUpdatesIndexer ¶ added in v0.6.0
type BlockChainUpdatesIndexer struct {
// contains filtered or unexported fields
}
BlockChainUpdatesIndexer indexes chain updates for each block.
func BlockChainUpdates ¶ added in v0.6.0
func BlockChainUpdates(batch *database.Batch, network *config.Network, blockIndex uint64) *BlockChainUpdatesIndexer
BlockChainUpdates returns a block updates indexer.
func (*BlockChainUpdatesIndexer) Get ¶ added in v0.6.0
func (bu *BlockChainUpdatesIndexer) Get() (*BlockChainUpdatesIndex, error)
Get loads and unmarshals the index. Get returns an empty index if it has not been defined.
func (*BlockChainUpdatesIndexer) Set ¶ added in v0.6.0
func (bu *BlockChainUpdatesIndexer) Set(updates []ChainUpdate) error
Set adds the updates array to the index.
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) MarshalJSON ¶ added in v0.6.0
func (v *BlockStateIndex) MarshalJSON() ([]byte, error)
func (*BlockStateIndex) UnmarshalBinary ¶
func (v *BlockStateIndex) UnmarshalBinary(data []byte) error
func (*BlockStateIndex) UnmarshalBinaryFrom ¶
func (v *BlockStateIndex) UnmarshalBinaryFrom(rd io.Reader) error
func (*BlockStateIndex) UnmarshalJSON ¶ added in v0.6.0
func (v *BlockStateIndex) UnmarshalJSON(data []byte) 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 ChainUpdate ¶ added in v0.6.0
type ChainUpdate struct { Account *url.URL `json:"account,omitempty" form:"account" query:"account" validate:"required"` Name string `json:"name,omitempty" form:"name" query:"name" validate:"required"` Type protocol.ChainType `json:"type,omitempty" form:"type" query:"type" validate:"required"` Index uint64 `json:"index,omitempty" form:"index" query:"index" validate:"required"` SourceIndex uint64 `json:"sourceIndex,omitempty" form:"sourceIndex" query:"sourceIndex" validate:"required"` SourceBlock uint64 `json:"sourceBlock,omitempty" form:"sourceBlock" query:"sourceBlock" validate:"required"` Entry []byte `json:"entry,omitempty" form:"entry" query:"entry" validate:"required"` // contains filtered or unexported fields }
func (*ChainUpdate) Copy ¶ added in v0.6.0
func (v *ChainUpdate) Copy() *ChainUpdate
func (*ChainUpdate) CopyAsInterface ¶ added in v0.6.0
func (v *ChainUpdate) CopyAsInterface() interface{}
func (*ChainUpdate) Equal ¶ added in v0.6.0
func (v *ChainUpdate) Equal(u *ChainUpdate) bool
func (*ChainUpdate) IsValid ¶ added in v0.6.0
func (v *ChainUpdate) IsValid() error
func (*ChainUpdate) MarshalBinary ¶ added in v0.6.0
func (v *ChainUpdate) MarshalBinary() ([]byte, error)
func (*ChainUpdate) MarshalJSON ¶ added in v0.6.0
func (v *ChainUpdate) MarshalJSON() ([]byte, error)
func (*ChainUpdate) UnmarshalBinary ¶ added in v0.6.0
func (v *ChainUpdate) UnmarshalBinary(data []byte) error
func (*ChainUpdate) UnmarshalBinaryFrom ¶ added in v0.6.0
func (v *ChainUpdate) UnmarshalBinaryFrom(rd io.Reader) error
func (*ChainUpdate) UnmarshalJSON ¶ added in v0.6.0
func (v *ChainUpdate) UnmarshalJSON(data []byte) error
type DirectoryIndex ¶ added in v0.6.0
type DirectoryIndex struct {
// contains filtered or unexported fields
}
func Directory ¶ added in v0.6.0
func Directory(batch *database.Batch, account *url.URL) *DirectoryIndex
func (*DirectoryIndex) Count ¶ added in v0.6.0
func (d *DirectoryIndex) 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 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) MarshalJSON ¶ added in v0.6.0
func (v *TransactionChainIndex) MarshalJSON() ([]byte, error)
func (*TransactionChainIndex) UnmarshalBinary ¶
func (v *TransactionChainIndex) UnmarshalBinary(data []byte) error
func (*TransactionChainIndex) UnmarshalBinaryFrom ¶
func (v *TransactionChainIndex) UnmarshalBinaryFrom(rd io.Reader) error
func (*TransactionChainIndex) UnmarshalJSON ¶ added in v0.6.0
func (v *TransactionChainIndex) UnmarshalJSON(data []byte) 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.