Documentation ¶
Overview ¶
Package query implements indexing and querying of annotated blockchain data.
Index ¶
- Constants
- Variables
- type Annotator
- type Indexer
- func (ind *Indexer) Accounts(ctx context.Context, p filter.Predicate, vals []interface{}, after string, ...) ([]map[string]interface{}, string, error)
- func (ind *Indexer) Assets(ctx context.Context, p filter.Predicate, vals []interface{}, after string, ...) ([]map[string]interface{}, string, error)
- func (ind *Indexer) Balances(ctx context.Context, p filter.Predicate, vals []interface{}, ...) ([]interface{}, error)
- func (ind *Indexer) IndexTransactions(ctx context.Context, b *bc.Block) error
- func (ind *Indexer) LookupTxAfter(ctx context.Context, begin, end uint64) (TxAfter, error)
- func (ind *Indexer) Outputs(ctx context.Context, p filter.Predicate, vals []interface{}, ...) ([]interface{}, *OutputsAfter, error)
- func (ind *Indexer) ProcessBlocks(ctx context.Context)
- func (ind *Indexer) RegisterAnnotator(annotator Annotator)
- func (ind *Indexer) SaveAnnotatedAccount(ctx context.Context, accountID string, account map[string]interface{}) error
- func (ind *Indexer) SaveAnnotatedAsset(ctx context.Context, assetID bc.AssetID, asset map[string]interface{}, ...) error
- func (ind *Indexer) Transactions(ctx context.Context, p filter.Predicate, vals []interface{}, after TxAfter, ...) ([]interface{}, *TxAfter, error)
- func (ind *Indexer) TxFeeds(ctx context.Context, after string, limit int) ([]*txfeed.TxFeed, string, error)
- type OutputsAfter
- type TxAfter
Constants ¶
const ( // TxPinName is used to identify the pin associated // with the transaction block processor. TxPinName = "tx" )
Variables ¶
var ( ErrBadAfter = errors.New("malformed pagination parameter after") ErrParameterCountMismatch = errors.New("wrong number of parameters to query") )
Functions ¶
This section is empty.
Types ¶
type Annotator ¶
Annotator describes a function capable of adding annotations to transactions, inputs and outputs.
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer creates, updates and queries against indexes.
func NewIndexer ¶
NewIndexer constructs a new indexer for indexing transactions.
func (*Indexer) Accounts ¶
func (ind *Indexer) Accounts(ctx context.Context, p filter.Predicate, vals []interface{}, after string, limit int) ([]map[string]interface{}, string, error)
Accounts queries the blockchain for accounts matching the query `q`.
func (*Indexer) Assets ¶
func (ind *Indexer) Assets(ctx context.Context, p filter.Predicate, vals []interface{}, after string, limit int) ([]map[string]interface{}, string, error)
Assets queries the blockchain for annotated assets matching the query.
func (*Indexer) Balances ¶
func (ind *Indexer) Balances(ctx context.Context, p filter.Predicate, vals []interface{}, sumBy []filter.Field, timestampMS uint64) ([]interface{}, error)
Balances performs a balances query against the annotated_outputs.
func (*Indexer) IndexTransactions ¶
IndexTransactions is registered as a block callback on the Chain. It saves all annotated transactions to the database.
func (*Indexer) LookupTxAfter ¶
LookupTxAfter looks up the transaction `after` for the provided time range.
func (*Indexer) Outputs ¶
func (ind *Indexer) Outputs(ctx context.Context, p filter.Predicate, vals []interface{}, timestampMS uint64, after *OutputsAfter, limit int) ([]interface{}, *OutputsAfter, error)
func (*Indexer) ProcessBlocks ¶
func (*Indexer) RegisterAnnotator ¶
RegisterAnnotator adds an additional annotator capable of mutating the annotated transaction object.
func (*Indexer) SaveAnnotatedAccount ¶
func (ind *Indexer) SaveAnnotatedAccount(ctx context.Context, accountID string, account map[string]interface{}) error
SaveAnnotatedAccount saves an annotated account to the query indexes.
func (*Indexer) SaveAnnotatedAsset ¶
func (ind *Indexer) SaveAnnotatedAsset(ctx context.Context, assetID bc.AssetID, asset map[string]interface{}, sortID string) error
SaveAnnotatedAsset saves an annotated asset to the query indexes.
type OutputsAfter ¶
type OutputsAfter struct {
// contains filtered or unexported fields
}
func DecodeOutputsAfter ¶
func DecodeOutputsAfter(str string) (c *OutputsAfter, err error)
func (OutputsAfter) String ¶
func (cur OutputsAfter) String() string
type TxAfter ¶
type TxAfter struct { // FromBlockHeight and FromPosition uniquely identify the last transaction returned // by a list-transactions query. // // If list-transactions is called with a time range instead of an `after`, these fields // are populated with the position of the transaction at the start of the time range. FromBlockHeight uint64 // exclusive FromPosition uint32 // exclusive // StopBlockHeight identifies the last block that should be included in a transaction // list. It is used when list-transactions is called with a time range instead // of an `after`. StopBlockHeight uint64 // inclusive }