Documentation
¶
Index ¶
- type Collections
- func (c *Collections) BatchStoreAndIndexByTransaction(_ lockctx.Proof, _ *flow.Collection, _ storage.ReaderBatchWriter) (*flow.LightCollection, error)
- func (c *Collections) ByID(collID flow.Identifier) (*flow.Collection, error)
- func (c *Collections) Data() []flow.Collection
- func (c *Collections) LightByID(collID flow.Identifier) (*flow.LightCollection, error)
- func (c *Collections) LightByTransactionID(txID flow.Identifier) (*flow.LightCollection, error)
- func (c *Collections) LightCollections() []flow.LightCollection
- func (c *Collections) Remove(collID flow.Identifier) error
- func (c *Collections) Store(collection *flow.Collection) (*flow.LightCollection, error)
- func (c *Collections) StoreAndIndexByTransaction(_ lockctx.Proof, collection *flow.Collection) (*flow.LightCollection, error)
- type Events
- func (e *Events) BatchRemoveByBlockID(flow.Identifier, storage.ReaderBatchWriter) error
- func (e *Events) BatchStore(flow.Identifier, []flow.EventsList, storage.ReaderBatchWriter) error
- func (e *Events) ByBlockID(blockID flow.Identifier) ([]flow.Event, error)
- func (e *Events) ByBlockIDEventType(blockID flow.Identifier, eventType flow.EventType) ([]flow.Event, error)
- func (e *Events) ByBlockIDTransactionID(blockID flow.Identifier, txID flow.Identifier) ([]flow.Event, error)
- func (e *Events) ByBlockIDTransactionIndex(blockID flow.Identifier, txIndex uint32) ([]flow.Event, error)
- func (e *Events) Data() flow.EventsList
- func (e *Events) Store(blockID flow.Identifier, blockEvents []flow.EventsList) error
- type LightTransactionResults
- func (l *LightTransactionResults) BatchStore(flow.Identifier, []flow.LightTransactionResult, storage.ReaderBatchWriter) error
- func (l *LightTransactionResults) BatchStoreBadger(flow.Identifier, []flow.LightTransactionResult, storage.BatchStorage) error
- func (l *LightTransactionResults) ByBlockID(id flow.Identifier) ([]flow.LightTransactionResult, error)
- func (l *LightTransactionResults) ByBlockIDTransactionID(blockID flow.Identifier, transactionID flow.Identifier) (*flow.LightTransactionResult, error)
- func (l *LightTransactionResults) ByBlockIDTransactionIndex(blockID flow.Identifier, txIndex uint32) (*flow.LightTransactionResult, error)
- func (l *LightTransactionResults) Data() []flow.LightTransactionResult
- func (l *LightTransactionResults) Store(blockID flow.Identifier, transactionResults []flow.LightTransactionResult) error
- type Registers
- func (r *Registers) Data(height uint64) ([]flow.RegisterEntry, error)
- func (r *Registers) FirstHeight() uint64
- func (r *Registers) Get(registerID flow.RegisterID, height uint64) (flow.RegisterValue, error)
- func (r *Registers) LatestHeight() uint64
- func (r *Registers) Store(registers flow.RegisterEntries, height uint64) error
- type TransactionResultErrorMessages
- func (t *TransactionResultErrorMessages) BatchStore(blockID flow.Identifier, ...) error
- func (t *TransactionResultErrorMessages) ByBlockID(id flow.Identifier) ([]flow.TransactionResultErrorMessage, error)
- func (t *TransactionResultErrorMessages) ByBlockIDTransactionID(blockID flow.Identifier, transactionID flow.Identifier) (*flow.TransactionResultErrorMessage, error)
- func (t *TransactionResultErrorMessages) ByBlockIDTransactionIndex(blockID flow.Identifier, txIndex uint32) (*flow.TransactionResultErrorMessage, error)
- func (t *TransactionResultErrorMessages) Data() []flow.TransactionResultErrorMessage
- func (t *TransactionResultErrorMessages) Exists(blockID flow.Identifier) (bool, error)
- func (t *TransactionResultErrorMessages) Store(blockID flow.Identifier, ...) error
- type Transactions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collections ¶
type Collections struct {
// contains filtered or unexported fields
}
func NewCollections ¶
func NewCollections(transactions *Transactions) *Collections
func (*Collections) BatchStoreAndIndexByTransaction ¶ added in v0.43.0
func (c *Collections) BatchStoreAndIndexByTransaction(_ lockctx.Proof, _ *flow.Collection, _ storage.ReaderBatchWriter) (*flow.LightCollection, error)
BatchStoreAndIndexByTransaction stores a light collection and indexes it by transaction ID within a batch operation.
CAUTION: current approach is NOT BFT and needs to be revised in the future. Honest clusters ensure a transaction can only belong to one collection. However, in rare cases, the collector clusters can exceed byzantine thresholds -- making it possible to produce multiple finalized collections (aka guaranteed collections) containing the same transaction repeatedly. TODO: eventually we need to handle Byzantine clusters
This method is not implemented and will always return an error.
func (*Collections) ByID ¶
func (c *Collections) ByID(collID flow.Identifier) (*flow.Collection, error)
ByID returns the collection with the given ID, including all transactions within the collection.
Expected errors during normal operation:
- `storage.ErrNotFound` if no light collection was found.
func (*Collections) Data ¶ added in v0.42.0
func (c *Collections) Data() []flow.Collection
Data returns a copy of stored collections
func (*Collections) LightByID ¶
func (c *Collections) LightByID(collID flow.Identifier) (*flow.LightCollection, error)
LightByID returns collection with the given ID. Only retrieves transaction hashes.
Expected errors during normal operation:
- `storage.ErrNotFound` if no light collection was found.
func (*Collections) LightByTransactionID ¶
func (c *Collections) LightByTransactionID(txID flow.Identifier) (*flow.LightCollection, error)
LightByTransactionID returns the collection for the given transaction ID. Only retrieves transaction hashes.
Expected errors during normal operation:
- `storage.ErrNotFound` if no light collection was found.
func (*Collections) LightCollections ¶ added in v0.42.0
func (c *Collections) LightCollections() []flow.LightCollection
LightCollections returns a copy of stored light collections
func (*Collections) Remove ¶
func (c *Collections) Remove(collID flow.Identifier) error
Remove removes the collection and all constituent transactions. No errors are expected during normal operation.
func (*Collections) Store ¶
func (c *Collections) Store(collection *flow.Collection) (*flow.LightCollection, error)
Store inserts the collection keyed by ID and all constituent transactions. No errors are expected during normal operation.
func (*Collections) StoreAndIndexByTransaction ¶ added in v0.43.0
func (c *Collections) StoreAndIndexByTransaction(_ lockctx.Proof, collection *flow.Collection) (*flow.LightCollection, error)
StoreAndIndexByTransaction inserts the light collection (only transaction IDs) and adds a transaction id index for each of the transactions within the collection (transaction_id->collection_id).
CAUTION: current approach is NOT BFT and needs to be revised in the future. Honest clusters ensure a transaction can only belong to one collection. However, in rare cases, the collector clusters can exceed byzantine thresholds -- making it possible to produce multiple finalized collections (aka guaranteed collections) containing the same transaction repeatedly. TODO: eventually we need to handle Byzantine clusters
No errors are expected during normal operation.
type Events ¶
type Events struct {
// contains filtered or unexported fields
}
func (*Events) BatchRemoveByBlockID ¶
func (e *Events) BatchRemoveByBlockID(flow.Identifier, storage.ReaderBatchWriter) error
BatchRemoveByBlockID removes events keyed by a blockID in provided batch No errors are expected during normal operation, even if no entries are matched. If database unexpectedly fails to process the request, the error is wrapped in a generic error and returned.
This method is NOT implemented and will always return an error.
func (*Events) BatchStore ¶
func (e *Events) BatchStore(flow.Identifier, []flow.EventsList, storage.ReaderBatchWriter) error
BatchStore will store events for the given block ID in a given batch.
This method is NOT implemented and will always return an error.
func (*Events) ByBlockID ¶
ByBlockID returns the events for the given block ID.
Expected errors during normal operation:
- `storage.ErrNotFound` if no events were found at given block.
func (*Events) ByBlockIDEventType ¶
func (e *Events) ByBlockIDEventType(blockID flow.Identifier, eventType flow.EventType) ([]flow.Event, error)
ByBlockIDEventType returns the events for the given block ID and event type.
Expected errors during normal operation:
- `storage.ErrNotFound` if no events were found at given block.
func (*Events) ByBlockIDTransactionID ¶
func (e *Events) ByBlockIDTransactionID(blockID flow.Identifier, txID flow.Identifier) ([]flow.Event, error)
ByBlockIDTransactionID returns the events for the given block ID and transaction ID.
Expected errors during normal operation:
- `storage.ErrNotFound` if no events were found at given block and transaction.
func (*Events) ByBlockIDTransactionIndex ¶
func (e *Events) ByBlockIDTransactionIndex(blockID flow.Identifier, txIndex uint32) ([]flow.Event, error)
ByBlockIDTransactionIndex returns the events for the transaction at given index in a given block
Expected errors during normal operation:
- `storage.ErrNotFound` if no events were found at given block and transaction.
func (*Events) Data ¶ added in v0.42.0
func (e *Events) Data() flow.EventsList
Data returns a copy of the cached blockID -> events map as EventsList.
func (*Events) Store ¶
func (e *Events) Store(blockID flow.Identifier, blockEvents []flow.EventsList) error
Store will store events for the given block ID. No errors are expected during normal operation.
type LightTransactionResults ¶
type LightTransactionResults struct {
// contains filtered or unexported fields
}
func NewLightTransactionResults ¶
func NewLightTransactionResults() *LightTransactionResults
func (*LightTransactionResults) BatchStore ¶
func (l *LightTransactionResults) BatchStore(flow.Identifier, []flow.LightTransactionResult, storage.ReaderBatchWriter) error
BatchStore inserts a batch of transaction result into a batch. This method is not implemented and will always return an error.
func (*LightTransactionResults) BatchStoreBadger ¶
func (l *LightTransactionResults) BatchStoreBadger(flow.Identifier, []flow.LightTransactionResult, storage.BatchStorage) error
BatchStoreBadger inserts a batch of transaction result into a storage. Deprecated: deprecated as a part of transition from Badger to Pebble. use BatchStore instead. This method is not implemented and will always return an error.
func (*LightTransactionResults) ByBlockID ¶
func (l *LightTransactionResults) ByBlockID(id flow.Identifier) ([]flow.LightTransactionResult, error)
ByBlockID gets all transaction results for a block, ordered by transaction index
Expected errors during normal operation:
- `storage.ErrNotFound` if light transaction results at given blockID weren't found.
func (*LightTransactionResults) ByBlockIDTransactionID ¶
func (l *LightTransactionResults) ByBlockIDTransactionID(blockID flow.Identifier, transactionID flow.Identifier) (*flow.LightTransactionResult, error)
ByBlockIDTransactionID returns the transaction result for the given block ID and transaction
Expected errors during normal operation:
- `storage.ErrNotFound` if light transaction result at given blockID wasn't found.
func (*LightTransactionResults) ByBlockIDTransactionIndex ¶
func (l *LightTransactionResults) ByBlockIDTransactionIndex(blockID flow.Identifier, txIndex uint32) (*flow.LightTransactionResult, error)
ByBlockIDTransactionIndex returns the transaction result for the given blockID and transaction index
Expected errors during normal operation:
- `storage.ErrNotFound` if light transaction result at given blockID and txIndex wasn't found.
func (*LightTransactionResults) Data ¶ added in v0.42.0
func (l *LightTransactionResults) Data() []flow.LightTransactionResult
Data returns a copy of the cached light transaction results grouped by block ID.
func (*LightTransactionResults) Store ¶
func (l *LightTransactionResults) Store(blockID flow.Identifier, transactionResults []flow.LightTransactionResult) error
Store inserts a transaction results into a storage No errors are expected during normal operation.
type Registers ¶
type Registers struct {
// contains filtered or unexported fields
}
Registers is a simple in-memory implementation of the RegisterIndex interface. It stores registers for a single block height.
func NewRegisters ¶
func (*Registers) Data ¶ added in v0.42.0
func (r *Registers) Data(height uint64) ([]flow.RegisterEntry, error)
Data returns all register entries for the specified height. No errors are expected during normal operation.
func (*Registers) FirstHeight ¶
FirstHeight returns the first indexed height found in the store.
func (*Registers) Get ¶
func (r *Registers) Get(registerID flow.RegisterID, height uint64) (flow.RegisterValue, error)
Get returns a register by the register ID at a storage's block height.
Expected errors: - storage.ErrNotFound if the register does not exist in this storage object - storage.ErrHeightNotIndexed if the given height does not match the storage's block height
func (*Registers) LatestHeight ¶
LatestHeight returns the latest indexed height.
type TransactionResultErrorMessages ¶
type TransactionResultErrorMessages struct {
// contains filtered or unexported fields
}
func NewTransactionResultErrorMessages ¶
func NewTransactionResultErrorMessages() *TransactionResultErrorMessages
func (*TransactionResultErrorMessages) BatchStore ¶ added in v0.43.0
func (t *TransactionResultErrorMessages) BatchStore(blockID flow.Identifier, transactionResultErrorMessages []flow.TransactionResultErrorMessage, batch storage.ReaderBatchWriter) error
BatchStore inserts a batch of transaction result error messages into a batch This method is not implemented and will always return an error.
func (*TransactionResultErrorMessages) ByBlockID ¶
func (t *TransactionResultErrorMessages) ByBlockID(id flow.Identifier) ([]flow.TransactionResultErrorMessage, error)
ByBlockID gets all transaction result error messages for a block, ordered by transaction index. Note: This method will return an empty slice both if the block is not indexed yet and if the block does not have any errors.
Expected errors during normal operation:
- `storage.ErrNotFound` if no block was found.
func (*TransactionResultErrorMessages) ByBlockIDTransactionID ¶
func (t *TransactionResultErrorMessages) ByBlockIDTransactionID( blockID flow.Identifier, transactionID flow.Identifier, ) (*flow.TransactionResultErrorMessage, error)
ByBlockIDTransactionID returns the transaction result error message for the given block ID and transaction ID.
Expected errors during normal operation:
- `storage.ErrNotFound` if no transaction error message is known at given block and transaction id.
func (*TransactionResultErrorMessages) ByBlockIDTransactionIndex ¶
func (t *TransactionResultErrorMessages) ByBlockIDTransactionIndex( blockID flow.Identifier, txIndex uint32, ) (*flow.TransactionResultErrorMessage, error)
ByBlockIDTransactionIndex returns the transaction result error message for the given blockID and transaction index.
Expected errors during normal operation:
- `storage.ErrNotFound` if no transaction error message is known at given block and transaction index.
func (*TransactionResultErrorMessages) Data ¶ added in v0.42.0
func (t *TransactionResultErrorMessages) Data() []flow.TransactionResultErrorMessage
Data returns a copy of all stored transaction result error messages keyed by block ID.
func (*TransactionResultErrorMessages) Exists ¶
func (t *TransactionResultErrorMessages) Exists(blockID flow.Identifier) (bool, error)
Exists returns true if transaction result error messages for the given ID have been stored.
No errors are expected during normal operation.
func (*TransactionResultErrorMessages) Store ¶
func (t *TransactionResultErrorMessages) Store( blockID flow.Identifier, transactionResultErrorMessages []flow.TransactionResultErrorMessage, ) error
Store will store transaction result error messages for the given block ID.
No errors are expected during normal operation.
type Transactions ¶
type Transactions struct {
// contains filtered or unexported fields
}
func NewTransactions ¶
func NewTransactions() *Transactions
func (*Transactions) BatchStore ¶ added in v0.43.0
func (t *Transactions) BatchStore(_ *flow.TransactionBody, _ storage.ReaderBatchWriter) error
BatchStore stores transaction within a batch operation. This method is not implemented and will always return an error.
func (*Transactions) ByID ¶
func (t *Transactions) ByID(txID flow.Identifier) (*flow.TransactionBody, error)
ByID returns the transaction for the given fingerprint. Expected errors during normal operation:
- `storage.ErrNotFound` if transaction is not found.
func (*Transactions) Data ¶ added in v0.42.0
func (t *Transactions) Data() []flow.TransactionBody
Data returns a copy of the internal transaction map.
func (*Transactions) Store ¶
func (t *Transactions) Store(tx *flow.TransactionBody) error
Store inserts the transaction, keyed by fingerprint. Duplicate transaction insertion is ignored No errors are expected during normal operation.