Documentation
¶
Index ¶
- func AppendPrefixKeyPart(buf []byte, v any) []byte
- func BatchIndexLightTransactionResult(w storage.Writer, blockID flow.Identifier, txIndex uint32, ...) error
- func BatchIndexTransactionResultErrorMessage(w storage.Writer, blockID flow.Identifier, ...) error
- func BatchInsertLightTransactionResult(w storage.Writer, blockID flow.Identifier, ...) error
- func BatchInsertTransactionResultErrorMessage(w storage.Writer, blockID flow.Identifier, ...) error
- func BatchRemoveTransactionResultsByBlockID(blockID flow.Identifier, batch storage.ReaderBatchWriter) error
- func EncodeKeyPart(v interface{}) []byte
- func ExistChunkLocator(r storage.Reader, locatorID flow.Identifier) (bool, error)
- func ExistExecutionResult(r storage.Reader, blockID flow.Identifier) (bool, error)
- func Exists(key []byte, keyExists *bool) func(storage.Reader) error
- func FindHighestAtOrBelow(prefix []byte, height uint64, entity interface{}) func(storage.Reader) error
- func FindHighestAtOrBelowByPrefix(r storage.Reader, prefix []byte, height uint64, entity interface{}) (errToReturn error)
- func GetBlockIDsByStatus(r storage.Reader, blockIDs *[]flow.Identifier, targetUploadStatus bool) error
- func GetComputationResultUploadStatus(r storage.Reader, blockID flow.Identifier, wasUploadCompleted *bool) error
- func IndexCollectionPayload(w storage.Writer, blockID flow.Identifier, txIDs []flow.Identifier) error
- func IndexExecutionReceipts(w storage.Writer, blockID, receiptID flow.Identifier) error
- func IndexExecutionResult(w storage.Writer, blockID flow.Identifier, resultID flow.Identifier) error
- func IndexOwnExecutionReceipt(w storage.Writer, blockID flow.Identifier, receiptID flow.Identifier) error
- func IndexStateCommitment(w storage.Writer, blockID flow.Identifier, commit flow.StateCommitment) error
- func IndexTransactionResult(w storage.Writer, blockID flow.Identifier, txIndex uint32, ...) error
- func IndexVersionBeaconByHeight(w storage.Writer, beacon *flow.SealedVersionBeacon) error
- func InsertChunkDataPack(w storage.Writer, c *storage.StoredChunkDataPack) error
- func InsertChunkLocator(w storage.Writer, locator *chunks.Locator) error
- func InsertEvent(w storage.Writer, blockID flow.Identifier, event flow.Event) error
- func InsertExecutionReceiptMeta(w storage.Writer, receiptID flow.Identifier, meta *flow.ExecutionReceiptMeta) error
- func InsertExecutionResult(w storage.Writer, result *flow.ExecutionResult) error
- func InsertExecutionStateInteractions(w storage.Writer, blockID flow.Identifier, ...) error
- func InsertJobAtIndex(w storage.Writer, queue string, index uint64, entity flow.Identifier) error
- func InsertLightTransactionResult(w storage.Writer, blockID flow.Identifier, ...) error
- func InsertResultApproval(w storage.Writer, approval *flow.ResultApproval) error
- func InsertServiceEvent(w storage.Writer, blockID flow.Identifier, event flow.Event) error
- func InsertTransactionResult(w storage.Writer, blockID flow.Identifier, ...) error
- func Iterate(startPrefix []byte, endPrefix []byte, check func(key []byte) error) func(storage.Reader) error
- func IterateKeys(r storage.Reader, startPrefix []byte, endPrefix []byte, iterFunc IterationFunc, ...) (errToReturn error)
- func IterateKeysByPrefixRange(r storage.Reader, startPrefix []byte, endPrefix []byte, ...) error
- func KeyExists(r storage.Reader, key []byte) (exist bool, errToReturn error)
- func LookupCollectionByTransaction(r storage.Reader, txID flow.Identifier, collectionID *flow.Identifier) error
- func LookupCollectionPayload(r storage.Reader, blockID flow.Identifier, txIDs *[]flow.Identifier) error
- func LookupEventsByBlockID(r storage.Reader, blockID flow.Identifier, events *[]flow.Event) error
- func LookupEventsByBlockIDEventType(r storage.Reader, blockID flow.Identifier, eventType flow.EventType, ...) error
- func LookupExecutionReceipts(r storage.Reader, blockID flow.Identifier, receiptIDs *[]flow.Identifier) error
- func LookupExecutionResult(r storage.Reader, blockID flow.Identifier, resultID *flow.Identifier) error
- func LookupLastVersionBeaconByHeight(r storage.Reader, maxHeight uint64, versionBeacon *flow.SealedVersionBeacon) error
- func LookupLightTransactionResultsByBlockIDUsingIndex(r storage.Reader, blockID flow.Identifier, ...) error
- func LookupOwnExecutionReceipt(r storage.Reader, blockID flow.Identifier, receiptID *flow.Identifier) error
- func LookupResultApproval(r storage.Reader, resultID flow.Identifier, chunkIndex uint64, ...) error
- func LookupServiceEventsByBlockID(r storage.Reader, blockID flow.Identifier, events *[]flow.Event) error
- func LookupStateCommitment(r storage.Reader, blockID flow.Identifier, commit *flow.StateCommitment) error
- func LookupTransactionResultErrorMessagesByBlockIDUsingIndex(r storage.Reader, blockID flow.Identifier, ...) error
- func LookupTransactionResultsByBlockIDUsingIndex(r storage.Reader, blockID flow.Identifier, txResults *[]flow.TransactionResult) error
- func MakePrefix(code byte, keys ...any) []byte
- func NewMultiDBStore(rwStore storage.DB, rStore storage.DB) storage.DB
- func NewMultiIterator(iterators ...storage.Iterator) (storage.Iterator, error)
- func NewMultiReader(readers ...storage.Reader) storage.Reader
- func NewMultiSeeker(seekers ...storage.Seeker) storage.Seeker
- func PersistNodeDisallowList(w storage.Writer, disallowList map[flow.Identifier]struct{}) error
- func PrintStats(log zerolog.Logger, stats map[byte]Stats)
- func PurgeNodeDisallowList(w storage.Writer) error
- func Remove(key []byte) func(storage.Writer) error
- func RemoveByKey(w storage.Writer, key []byte) error
- func RemoveByKeyPrefix(reader storage.Reader, w storage.Writer, prefix []byte) error
- func RemoveByKeyRange(reader storage.Reader, w storage.Writer, startPrefix []byte, endPrefix []byte) error
- func RemoveByPrefix(reader storage.Reader, key []byte) func(storage.Writer) error
- func RemoveByRange(reader storage.Reader, startPrefix []byte, endPrefix []byte) func(storage.Writer) error
- func RemoveChunkDataPack(w storage.Writer, chunkID flow.Identifier) error
- func RemoveCollection(w storage.Writer, collID flow.Identifier) error
- func RemoveCollectionPayloadIndices(w storage.Writer, blockID flow.Identifier) error
- func RemoveCollectionTransactionIndices(w storage.Writer, txID flow.Identifier) error
- func RemoveComputationResultUploadStatus(w storage.Writer, blockID flow.Identifier) error
- func RemoveEventsByBlockID(r storage.Reader, w storage.Writer, blockID flow.Identifier) error
- func RemoveExecutionResultIndex(w storage.Writer, blockID flow.Identifier) error
- func RemoveOwnExecutionReceipt(w storage.Writer, blockID flow.Identifier) error
- func RemoveServiceEventsByBlockID(r storage.Reader, w storage.Writer, blockID flow.Identifier) error
- func RemoveStateCommitment(w storage.Writer, blockID flow.Identifier) error
- func RemoveTransaction(r storage.Writer, txID flow.Identifier) error
- func RemoveTransactionResultsByBlockID(r storage.Reader, w storage.Writer, blockID flow.Identifier) error
- func Retrieve(key []byte, entity interface{}) func(storage.Reader) error
- func RetrieveByKey(r storage.Reader, key []byte, entity interface{}) (errToReturn error)
- func RetrieveChunkDataPack(r storage.Reader, chunkID flow.Identifier, c *storage.StoredChunkDataPack) error
- func RetrieveChunkLocator(r storage.Reader, locatorID flow.Identifier, locator *chunks.Locator) error
- func RetrieveCollection(r storage.Reader, collID flow.Identifier, collection *flow.LightCollection) error
- func RetrieveEvents(r storage.Reader, blockID flow.Identifier, transactionID flow.Identifier, ...) error
- func RetrieveExecutedBlock(r storage.Reader, blockID *flow.Identifier) error
- func RetrieveExecutionReceiptMeta(r storage.Reader, receiptID flow.Identifier, meta *flow.ExecutionReceiptMeta) error
- func RetrieveExecutionResult(r storage.Reader, resultID flow.Identifier, result *flow.ExecutionResult) error
- func RetrieveExecutionStateInteractions(r storage.Reader, blockID flow.Identifier, ...) error
- func RetrieveJobAtIndex(r storage.Reader, queue string, index uint64, entity *flow.Identifier) error
- func RetrieveJobLatestIndex(r storage.Reader, queue string, index *uint64) error
- func RetrieveLightTransactionResult(r storage.Reader, blockID flow.Identifier, transactionID flow.Identifier, ...) error
- func RetrieveLightTransactionResultByIndex(r storage.Reader, blockID flow.Identifier, txIndex uint32, ...) error
- func RetrieveLivenessData(r storage.Reader, chainID flow.ChainID, livenessData *hotstuff.LivenessData) error
- func RetrieveNodeDisallowList(r storage.Reader, disallowList *map[flow.Identifier]struct{}) error
- func RetrieveProcessedIndex(r storage.Reader, jobName string, processed *uint64) error
- func RetrieveResultApproval(r storage.Reader, approvalID flow.Identifier, approval *flow.ResultApproval) error
- func RetrieveSafetyData(r storage.Reader, chainID flow.ChainID, safetyData *hotstuff.SafetyData) error
- func RetrieveTransaction(r storage.Reader, txID flow.Identifier, tx *flow.TransactionBody) error
- func RetrieveTransactionResult(r storage.Reader, blockID flow.Identifier, transactionID flow.Identifier, ...) error
- func RetrieveTransactionResultByIndex(r storage.Reader, blockID flow.Identifier, txIndex uint32, ...) error
- func RetrieveTransactionResultErrorMessage(r storage.Reader, blockID flow.Identifier, transactionID flow.Identifier, ...) error
- func RetrieveTransactionResultErrorMessageByIndex(r storage.Reader, blockID flow.Identifier, txIndex uint32, ...) error
- func SetJobLatestIndex(w storage.Writer, queue string, index uint64) error
- func SetProcessedIndex(w storage.Writer, jobName string, processed uint64) error
- func SummarizeKeysByFirstByteConcurrent(log zerolog.Logger, r storage.Reader, nWorker int) (map[byte]Stats, error)
- func TransactionResultErrorMessagesExists(r storage.Reader, blockID flow.Identifier, blockExists *bool) error
- func Traverse(prefix []byte, iterFunc IterationFunc, opt storage.IteratorOption) func(storage.Reader) error
- func TraverseByPrefix(r storage.Reader, prefix []byte, iterFunc IterationFunc, ...) error
- func UnsafeIndexCollectionByTransaction(w storage.Writer, txID flow.Identifier, collectionID flow.Identifier) error
- func UnsafeIndexResultApproval(w storage.Writer, resultID flow.Identifier, chunkIndex uint64, ...) error
- func UpdateExecutedBlock(w storage.Writer, blockID flow.Identifier) error
- func Upsert(key []byte, val interface{}) func(storage.Writer) error
- func UpsertByKey(w storage.Writer, key []byte, val interface{}) error
- func UpsertCollection(w storage.Writer, collection *flow.LightCollection) error
- func UpsertComputationResultUploadStatus(w storage.Writer, blockID flow.Identifier, wasUploadCompleted bool) error
- func UpsertLivenessData(w storage.Writer, chainID flow.ChainID, livenessData *hotstuff.LivenessData) error
- func UpsertSafetyData(w storage.Writer, chainID flow.ChainID, safetyData *hotstuff.SafetyData) error
- func UpsertTransaction(w storage.Writer, txID flow.Identifier, tx *flow.TransactionBody) error
- type BatchLocks
- type Callbacks
- type CheckFunc
- type CreateFunc
- type HandleFunc
- type IterationFunc
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendPrefixKeyPart ¶ added in v0.41.0
AppendPrefixKeyPart appends v in binary prefix format to buf. NOTE: this function needs to be in sync with prefixKeyPartLength.
func BatchIndexLightTransactionResult ¶ added in v0.39.4
func BatchIndexLightTransactionResult(w storage.Writer, blockID flow.Identifier, txIndex uint32, transactionResult *flow.LightTransactionResult) error
func BatchIndexTransactionResultErrorMessage ¶ added in v0.39.4
func BatchIndexTransactionResultErrorMessage(w storage.Writer, blockID flow.Identifier, transactionResultErrorMessage *flow.TransactionResultErrorMessage) error
BatchIndexTransactionResultErrorMessage indexes a transaction result error message by index within the block using a batch write.
func BatchInsertLightTransactionResult ¶ added in v0.39.4
func BatchInsertLightTransactionResult(w storage.Writer, blockID flow.Identifier, transactionResult *flow.LightTransactionResult) error
func BatchInsertTransactionResultErrorMessage ¶ added in v0.39.4
func BatchInsertTransactionResultErrorMessage(w storage.Writer, blockID flow.Identifier, transactionResultErrorMessage *flow.TransactionResultErrorMessage) error
BatchInsertTransactionResultErrorMessage inserts a transaction result error message by block ID and transaction ID into the database using a batch write.
func BatchRemoveTransactionResultsByBlockID ¶ added in v0.39.4
func BatchRemoveTransactionResultsByBlockID(blockID flow.Identifier, batch storage.ReaderBatchWriter) error
BatchRemoveTransactionResultsByBlockID removes transaction results for the given blockID in a provided batch. No errors are expected during normal operation, but it may return generic error if badger fails to process request
func EncodeKeyPart ¶
func EncodeKeyPart(v interface{}) []byte
EncodeKeyPart encodes a value to be used as a part of a key to be stored in storage.
func ExistChunkLocator ¶ added in v0.39.1
func ExistExecutionResult ¶ added in v0.39.4
func FindHighestAtOrBelow ¶
func FindHighestAtOrBelowByPrefix ¶
func FindHighestAtOrBelowByPrefix(r storage.Reader, prefix []byte, height uint64, entity interface{}) (errToReturn error)
FindHighestAtOrBelowByPrefix is for database entries that are indexed by block height. It is suitable to search keys with the format prefix` + `height` (where "+" denotes concatenation of binary strings). The height is encoded as Big-Endian (entries with numerically smaller height have lexicographically smaller key). The function finds the *highest* key with the given prefix and height equal to or below the given height.
func GetBlockIDsByStatus ¶ added in v0.39.2
func GetBlockIDsByStatus(r storage.Reader, blockIDs *[]flow.Identifier, targetUploadStatus bool) error
GetBlockIDsByStatus returns all IDs of stored ComputationResult instances.
func GetComputationResultUploadStatus ¶ added in v0.39.2
func GetComputationResultUploadStatus(r storage.Reader, blockID flow.Identifier, wasUploadCompleted *bool) error
GetComputationResult returns stored ComputationResult instance with given ID.
func IndexCollectionPayload ¶ added in v0.39.4
func IndexCollectionPayload(w storage.Writer, blockID flow.Identifier, txIDs []flow.Identifier) error
IndexCollectionPayload will overwrite any existing index, which is acceptable because the blockID is derived from txIDs within the payload, ensuring its uniqueness.
func IndexExecutionReceipts ¶ added in v0.39.4
func IndexExecutionReceipts(w storage.Writer, blockID, receiptID flow.Identifier) error
IndexExecutionReceipts inserts an execution receipt ID keyed by block ID and receipt ID. one block could have multiple receipts, even if they are from the same executor
func IndexExecutionResult ¶ added in v0.39.4
func IndexExecutionResult(w storage.Writer, blockID flow.Identifier, resultID flow.Identifier) error
IndexExecutionResult inserts an execution result ID keyed by block ID
func IndexOwnExecutionReceipt ¶ added in v0.39.4
func IndexOwnExecutionReceipt(w storage.Writer, blockID flow.Identifier, receiptID flow.Identifier) error
IndexOwnExecutionReceipt inserts an execution receipt ID keyed by block ID
func IndexStateCommitment ¶ added in v0.39.4
func IndexStateCommitment(w storage.Writer, blockID flow.Identifier, commit flow.StateCommitment) error
IndexStateCommitment indexes a state commitment.
State commitments are keyed by the block whose execution results in the state with the given commit.
func IndexTransactionResult ¶ added in v0.39.4
func IndexTransactionResult(w storage.Writer, blockID flow.Identifier, txIndex uint32, transactionResult *flow.TransactionResult) error
func IndexVersionBeaconByHeight ¶ added in v0.39.2
func IndexVersionBeaconByHeight( w storage.Writer, beacon *flow.SealedVersionBeacon, ) error
IndexVersionBeaconByHeight stores a sealed version beacon indexed by flow.SealedVersionBeacon.SealHeight.
No errors are expected during normal operation.
func InsertChunkDataPack ¶
func InsertChunkDataPack(w storage.Writer, c *storage.StoredChunkDataPack) error
InsertChunkDataPack inserts a chunk data pack keyed by chunk ID. any error are exceptions
func InsertChunkLocator ¶ added in v0.39.1
func InsertEvent ¶ added in v0.39.4
func InsertExecutionReceiptMeta ¶ added in v0.39.4
func InsertExecutionReceiptMeta(w storage.Writer, receiptID flow.Identifier, meta *flow.ExecutionReceiptMeta) error
InsertExecutionReceiptMeta inserts an execution receipt meta by ID.
func InsertExecutionResult ¶ added in v0.39.4
func InsertExecutionResult(w storage.Writer, result *flow.ExecutionResult) error
InsertExecutionResult inserts an execution result by ID.
func InsertExecutionStateInteractions ¶ added in v0.39.4
func InsertExecutionStateInteractions( w storage.Writer, blockID flow.Identifier, executionSnapshots []*snapshot.ExecutionSnapshot, ) error
func InsertJobAtIndex ¶ added in v0.39.1
InsertJobAtIndex insert an entity ID at the given index
func InsertLightTransactionResult ¶ added in v0.39.4
func InsertLightTransactionResult(w storage.Writer, blockID flow.Identifier, transactionResult *flow.LightTransactionResult) error
deprecated
func InsertResultApproval ¶
func InsertResultApproval(w storage.Writer, approval *flow.ResultApproval) error
InsertResultApproval inserts a ResultApproval by ID. The same key (`approval.ID()`) necessitates that the value (full `approval`) is also identical (otherwise, we would have a successful pre-image attack on our cryptographic hash function). Therefore, concurrent calls to this function are safe.
func InsertServiceEvent ¶ added in v0.39.4
func InsertTransactionResult ¶ added in v0.39.4
func InsertTransactionResult(w storage.Writer, blockID flow.Identifier, transactionResult *flow.TransactionResult) error
func IterateKeys ¶
func IterateKeys(r storage.Reader, startPrefix []byte, endPrefix []byte, iterFunc IterationFunc, opt storage.IteratorOption) (errToReturn error)
IterateKeys will iterate over all entries in the database, where the key starts with a prefixes in the range [startPrefix, endPrefix] (both inclusive). No errors expected during normal operations.
func IterateKeysByPrefixRange ¶
func IterateKeysByPrefixRange(r storage.Reader, startPrefix []byte, endPrefix []byte, check func(key []byte) error) error
IterateKeysByPrefixRange will iterate over all entries in the database, where the key starts with a prefixes in the range [startPrefix, endPrefix] (both inclusive). We require that startPrefix <= endPrefix (otherwise this function errors). On every such key, the `check` function is called. If `check` errors, iteration is aborted. In other words, error returned by the iteration functions will be propagated to the caller. No errors expected during normal operations.
func KeyExists ¶
KeyExists returns true if a key exists in the database. When this returned function is executed (and only then), it will write into the `keyExists` whether the key exists. No errors are expected during normal operation.
func LookupCollectionByTransaction ¶ added in v0.41.0
func LookupCollectionByTransaction(r storage.Reader, txID flow.Identifier, collectionID *flow.Identifier) error
LookupCollectionByTransaction looks up the collection indexed by the given transaction ID, which is the collection in which the given transaction was included. It returns storage.ErrNotFound if the collection is not found. No errors are expected during normal operaion.
func LookupCollectionPayload ¶ added in v0.39.4
func LookupCollectionPayload(r storage.Reader, blockID flow.Identifier, txIDs *[]flow.Identifier) error
LookupCollection looks up the collection for a given cluster payload.
func LookupEventsByBlockID ¶ added in v0.39.4
func LookupEventsByBlockIDEventType ¶ added in v0.39.4
func LookupExecutionReceipts ¶ added in v0.39.4
func LookupExecutionReceipts(r storage.Reader, blockID flow.Identifier, receiptIDs *[]flow.Identifier) error
LookupExecutionReceipts finds all execution receipts by block ID
func LookupExecutionResult ¶ added in v0.39.4
func LookupExecutionResult(r storage.Reader, blockID flow.Identifier, resultID *flow.Identifier) error
LookupExecutionResult finds execution result ID by block
func LookupLastVersionBeaconByHeight ¶ added in v0.39.2
func LookupLastVersionBeaconByHeight( r storage.Reader, maxHeight uint64, versionBeacon *flow.SealedVersionBeacon, ) error
Returns storage.ErrNotFound if no version beacon exists at or below the given height.
func LookupLightTransactionResultsByBlockIDUsingIndex ¶ added in v0.39.4
func LookupLightTransactionResultsByBlockIDUsingIndex(r storage.Reader, blockID flow.Identifier, txResults *[]flow.LightTransactionResult) error
LookupLightTransactionResultsByBlockIDUsingIndex retrieves all tx results for a block, but using tx_index index. This correctly handles cases of duplicate transactions within block.
func LookupOwnExecutionReceipt ¶ added in v0.39.4
func LookupOwnExecutionReceipt(r storage.Reader, blockID flow.Identifier, receiptID *flow.Identifier) error
LookupOwnExecutionReceipt finds execution receipt ID by block
func LookupResultApproval ¶
func LookupResultApproval(r storage.Reader, resultID flow.Identifier, chunkIndex uint64, approvalID *flow.Identifier) error
LookupResultApproval finds a ResultApproval by result ID and chunk index. Returns `storage.ErrNotFound` if no Approval for the given key (resultID, chunkIndex) has been stored.
NOTE that the Flow protocol requires multiple approvals for the same chunk from different verification nodes. In other words, there are multiple different approvals for the same chunk. Therefore, the index Executed Chunk ➜ ResultApproval ID (queried here) is *only safe* to be used by Verification Nodes for tracking their own approvals (for the same ExecutionResult, a Verifier will always produce the same approval)
func LookupServiceEventsByBlockID ¶ added in v0.39.4
func LookupStateCommitment ¶ added in v0.39.4
func LookupStateCommitment(r storage.Reader, blockID flow.Identifier, commit *flow.StateCommitment) error
LookupStateCommitment gets a state commitment keyed by block ID
State commitments are keyed by the block whose execution results in the state with the given commit.
func LookupTransactionResultErrorMessagesByBlockIDUsingIndex ¶ added in v0.39.4
func LookupTransactionResultErrorMessagesByBlockIDUsingIndex(r storage.Reader, blockID flow.Identifier, txResultErrorMessages *[]flow.TransactionResultErrorMessage) error
LookupTransactionResultErrorMessagesByBlockIDUsingIndex retrieves all tx result error messages for a block, by using tx_index index. This correctly handles cases of duplicate transactions within block.
func LookupTransactionResultsByBlockIDUsingIndex ¶ added in v0.39.4
func LookupTransactionResultsByBlockIDUsingIndex(r storage.Reader, blockID flow.Identifier, txResults *[]flow.TransactionResult) error
LookupTransactionResultsByBlockIDUsingIndex retrieves all tx results for a block, by using tx_index index. This correctly handles cases of duplicate transactions within block.
func MakePrefix ¶
func NewMultiDBStore ¶ added in v0.41.0
NewMultiDBStore returns a DB store that consists of a primary read-and-write store, and a secondary read-only store.
func NewMultiIterator ¶ added in v0.41.0
NewMultiIterator returns an Iterator that is a logical concatenation of multiple iterators in the provided sequence. The returned iterator iterates items in the first iterator, and then iterates items in the second iterator, etc. NewMultiIterator panics if 0 iterators are provided.
func NewMultiReader ¶ added in v0.41.0
NewMultiReader returns a Reader that consists of multiple readers in the provided order. Readers are read sequentially until - a reader succeeds or - a reader returns an error that is not ErrNotFound If all readers return ErrNotFound, Reader.Get will return ErrNotFound. NewMultiReader panics if 0 readers are provided.
func NewMultiSeeker ¶ added in v0.41.0
NewMultiSeeker returns a Seeker that consists of multiple seekers in the provided order. NewMultiSeeker panics if 0 seekers are provided.
func PersistNodeDisallowList ¶ added in v0.41.0
func PersistNodeDisallowList(w storage.Writer, disallowList map[flow.Identifier]struct{}) error
PersistNodeDisallowList writes the set of disallowed nodes IDs into the database. If an entry already exists, it is overwritten; otherwise a new entry is created. No errors are expected during normal operations.
TODO: TEMPORARY manual override for adding node IDs to list of ejected nodes, applies to networking layer only
func PrintStats ¶ added in v0.40.0
PrintStats logs the statistics for each prefix in ascending order. Each prefix is shown in hex, along with count, min, max, total, and average sizes.
func PurgeNodeDisallowList ¶ added in v0.41.0
PurgeNodeDisallowList removes the set of disallowed nodes IDs from the database. If no corresponding entry exists, this function is a no-op. No errors are expected during normal operations.
TODO: TEMPORARY manual override for adding node IDs to list of ejected nodes, applies to networking layer only
func RemoveByKey ¶
RemoveByKey removes the entity with the given key, if it exists. If it doesn't exist, this is a no-op. Error returns: * generic error in case of unexpected database error
func RemoveByKeyPrefix ¶
RemoveByKeyPrefix removes all keys with the given prefix Error returns: * generic error in case of unexpected database error
func RemoveByKeyRange ¶
func RemoveByKeyRange(reader storage.Reader, w storage.Writer, startPrefix []byte, endPrefix []byte) error
RemoveByKeyRange removes all keys with a prefix that falls within the range [start, end], both inclusive. It returns error if endPrefix < startPrefix no other errors are expected during normal operation
func RemoveByPrefix ¶
func RemoveByRange ¶
func RemoveChunkDataPack ¶
func RemoveChunkDataPack(w storage.Writer, chunkID flow.Identifier) error
RemoveChunkDataPack removes the chunk data pack with the given chunk ID. any error are exceptions
func RemoveCollection ¶ added in v0.39.4
func RemoveCollection(w storage.Writer, collID flow.Identifier) error
RemoveCollection removes a collection from the storage. It returns nil if the collection does not exist. No errors are expected during normal operation.
func RemoveCollectionPayloadIndices ¶ added in v0.41.0
func RemoveCollectionPayloadIndices(w storage.Writer, blockID flow.Identifier) error
RemoveCollectionPayloadIndices removes a collection id indexed by a block id No errors are expected during normal operation.
func RemoveCollectionTransactionIndices ¶ added in v0.41.0
func RemoveCollectionTransactionIndices(w storage.Writer, txID flow.Identifier) error
RemoveCollectionByTransactionIndex removes a collection id indexed by a transaction id, created by UnsafeIndexCollectionByTransaction. No errors are expected during normal operation.
func RemoveComputationResultUploadStatus ¶ added in v0.39.2
func RemoveComputationResultUploadStatus( w storage.Writer, blockID flow.Identifier) error
RemoveComputationResult removes an instance of ComputationResult with given ID.
func RemoveEventsByBlockID ¶ added in v0.39.4
func RemoveExecutionResultIndex ¶ added in v0.39.4
func RemoveExecutionResultIndex(w storage.Writer, blockID flow.Identifier) error
RemoveExecutionResultIndex removes execution result indexed by the given blockID
func RemoveOwnExecutionReceipt ¶ added in v0.39.4
func RemoveOwnExecutionReceipt(w storage.Writer, blockID flow.Identifier) error
RemoveOwnExecutionReceipt removes own execution receipt index by blockID
func RemoveServiceEventsByBlockID ¶ added in v0.39.4
func RemoveStateCommitment ¶ added in v0.39.4
func RemoveStateCommitment(w storage.Writer, blockID flow.Identifier) error
RemoveStateCommitment removes the state commitment by block ID
func RemoveTransaction ¶ added in v0.41.0
func RemoveTransaction(r storage.Writer, txID flow.Identifier) error
RemoveTransaction removes a transaction by ID.
func RemoveTransactionResultsByBlockID ¶ added in v0.39.4
func RemoveTransactionResultsByBlockID(r storage.Reader, w storage.Writer, blockID flow.Identifier) error
RemoveTransactionResultsByBlockID removes the transaction results for the given blockID
func RetrieveByKey ¶
RetrieveByKey will retrieve the binary data under the given key from the database and decode it into the given entity. The provided entity needs to be a pointer to an initialized entity of the correct type. Error returns:
- storage.ErrNotFound if the key does not exist in the database
- generic error in case of unexpected failure from the database layer, or failure to decode an existing database value
func RetrieveChunkDataPack ¶
func RetrieveChunkDataPack(r storage.Reader, chunkID flow.Identifier, c *storage.StoredChunkDataPack) error
RetrieveChunkDataPack retrieves a chunk data pack by chunk ID. it returns storage.ErrNotFound if the chunk data pack is not found
func RetrieveChunkLocator ¶ added in v0.39.1
func RetrieveCollection ¶ added in v0.39.4
func RetrieveCollection(r storage.Reader, collID flow.Identifier, collection *flow.LightCollection) error
func RetrieveEvents ¶ added in v0.39.4
func RetrieveEvents(r storage.Reader, blockID flow.Identifier, transactionID flow.Identifier, events *[]flow.Event) error
func RetrieveExecutedBlock ¶ added in v0.39.4
func RetrieveExecutedBlock(r storage.Reader, blockID *flow.Identifier) error
func RetrieveExecutionReceiptMeta ¶ added in v0.39.4
func RetrieveExecutionReceiptMeta(r storage.Reader, receiptID flow.Identifier, meta *flow.ExecutionReceiptMeta) error
RetrieveExecutionReceiptMeta retrieves a execution receipt meta by ID.
func RetrieveExecutionResult ¶ added in v0.39.4
func RetrieveExecutionResult(r storage.Reader, resultID flow.Identifier, result *flow.ExecutionResult) error
RetrieveExecutionResult retrieves a transaction by fingerprint.
func RetrieveExecutionStateInteractions ¶ added in v0.39.4
func RetrieveExecutionStateInteractions( r storage.Reader, blockID flow.Identifier, executionSnapshots *[]*snapshot.ExecutionSnapshot, ) error
func RetrieveJobAtIndex ¶ added in v0.39.1
func RetrieveJobAtIndex(r storage.Reader, queue string, index uint64, entity *flow.Identifier) error
RetrieveJobAtIndex returns the entity at the given index
func RetrieveJobLatestIndex ¶ added in v0.39.1
func RetrieveLightTransactionResult ¶ added in v0.39.4
func RetrieveLightTransactionResult(r storage.Reader, blockID flow.Identifier, transactionID flow.Identifier, transactionResult *flow.LightTransactionResult) error
func RetrieveLightTransactionResultByIndex ¶ added in v0.39.4
func RetrieveLightTransactionResultByIndex(r storage.Reader, blockID flow.Identifier, txIndex uint32, transactionResult *flow.LightTransactionResult) error
func RetrieveLivenessData ¶ added in v0.42.0
func RetrieveLivenessData(r storage.Reader, chainID flow.ChainID, livenessData *hotstuff.LivenessData) error
RetrieveLivenessData retrieves liveness data from the database.
func RetrieveNodeDisallowList ¶ added in v0.41.0
func RetrieveNodeDisallowList(r storage.Reader, disallowList *map[flow.Identifier]struct{}) error
RetrieveNodeDisallowList reads the set of disallowed node IDs from the database. Returns `storage.ErrNotFound` error in case no respective database entry is present.
TODO: TEMPORARY manual override for adding node IDs to list of ejected nodes, applies to networking layer only
func RetrieveProcessedIndex ¶
RetrieveProcessedIndex returns the processed index for a job consumer
func RetrieveResultApproval ¶
func RetrieveResultApproval(r storage.Reader, approvalID flow.Identifier, approval *flow.ResultApproval) error
RetrieveResultApproval retrieves an approval by ID. Returns `storage.ErrNotFound` if no Approval with the given ID has been stored.
func RetrieveSafetyData ¶ added in v0.42.0
func RetrieveSafetyData(r storage.Reader, chainID flow.ChainID, safetyData *hotstuff.SafetyData) error
RetrieveSafetyData retrieves safety data from the database.
func RetrieveTransaction ¶ added in v0.39.4
func RetrieveTransaction(r storage.Reader, txID flow.Identifier, tx *flow.TransactionBody) error
RetrieveTransaction retrieves a transaction by fingerprint.
func RetrieveTransactionResult ¶ added in v0.39.4
func RetrieveTransactionResult(r storage.Reader, blockID flow.Identifier, transactionID flow.Identifier, transactionResult *flow.TransactionResult) error
func RetrieveTransactionResultByIndex ¶ added in v0.39.4
func RetrieveTransactionResultByIndex(r storage.Reader, blockID flow.Identifier, txIndex uint32, transactionResult *flow.TransactionResult) error
func RetrieveTransactionResultErrorMessage ¶ added in v0.39.4
func RetrieveTransactionResultErrorMessage(r storage.Reader, blockID flow.Identifier, transactionID flow.Identifier, transactionResultErrorMessage *flow.TransactionResultErrorMessage) error
RetrieveTransactionResultErrorMessage retrieves a transaction result error message by block ID and transaction ID.
func RetrieveTransactionResultErrorMessageByIndex ¶ added in v0.39.4
func RetrieveTransactionResultErrorMessageByIndex(r storage.Reader, blockID flow.Identifier, txIndex uint32, transactionResultErrorMessage *flow.TransactionResultErrorMessage) error
RetrieveTransactionResultErrorMessageByIndex retrieves a transaction result error message by block ID and index.
func SetJobLatestIndex ¶ added in v0.39.1
func SetProcessedIndex ¶
SetProcessedIndex updates the processed index for a job consumer with given index
func SummarizeKeysByFirstByteConcurrent ¶ added in v0.40.0
func SummarizeKeysByFirstByteConcurrent(log zerolog.Logger, r storage.Reader, nWorker int) (map[byte]Stats, error)
SummarizeKeysByFirstByteConcurrent iterates over all prefixes [0x00..0xFF] in parallel using nWorker goroutines. Each worker handles one prefix at a time until all are processed.
The storage.Reader must be able to create multiple iterators concurrently.
func TransactionResultErrorMessagesExists ¶ added in v0.39.4
func TransactionResultErrorMessagesExists(r storage.Reader, blockID flow.Identifier, blockExists *bool) error
TransactionResultErrorMessagesExists checks whether tx result error messages exist in the database.
func Traverse ¶
func Traverse(prefix []byte, iterFunc IterationFunc, opt storage.IteratorOption) func(storage.Reader) error
func TraverseByPrefix ¶
func TraverseByPrefix(r storage.Reader, prefix []byte, iterFunc IterationFunc, opt storage.IteratorOption) error
Traverse will iterate over all keys with the given prefix error returned by the iteration functions will be propagated to the caller. No other errors are expected during normal operation.
func UnsafeIndexCollectionByTransaction ¶ added in v0.39.4
func UnsafeIndexCollectionByTransaction(w storage.Writer, txID flow.Identifier, collectionID flow.Identifier) error
UnsafeIndexCollectionByTransaction inserts a collection id keyed by a transaction id Unsafe because a transaction can belong to multiple collections, indexing collection by a transaction will overwrite the previous collection id that was indexed by the same transaction id To prevent overwritting, the caller must check if the transaction is already indexed, and make sure there is no dirty read before the writing by using locks.
func UnsafeIndexResultApproval ¶
func UnsafeIndexResultApproval(w storage.Writer, resultID flow.Identifier, chunkIndex uint64, approvalID flow.Identifier) error
UnsafeIndexResultApproval inserts a ResultApproval ID keyed by ExecutionResult ID and chunk index. Unsafe means that it does not check if a different approval is indexed for the same chunk, and will overwrite the existing index. CAUTION:
- In general, the Flow protocol requires multiple approvals for the same chunk from different verification nodes. In other words, there are multiple different approvals for the same chunk. Therefore, this index Executed Chunk ➜ ResultApproval ID is *only safe* to be used by Verification Nodes for tracking their own approvals (for the same ExecutionResult, a Verifier will always produce the same approval)
- In order to make sure only one approval is indexed for the chunk, _all calls_ to `UnsafeIndexResultApproval` must be synchronized by the higher-logic. Currently, we have the convention that `store.ResultApprovals` is the only place that is allowed to call this method.
func UpdateExecutedBlock ¶ added in v0.39.4
func UpdateExecutedBlock(w storage.Writer, blockID flow.Identifier) error
func UpsertByKey ¶
UpsertByKey will encode the given entity using msgpack and will insert the resulting binary data under the provided key. If the key already exists, the value will be overwritten. Error returns:
- generic error in case of unexpected failure from the database layer or encoding failure.
func UpsertCollection ¶ added in v0.39.4
func UpsertCollection(w storage.Writer, collection *flow.LightCollection) error
UpsertCollection inserts a light collection into the storage. If the collection already exists, it will be overwritten.
func UpsertComputationResultUploadStatus ¶ added in v0.39.2
func UpsertComputationResultUploadStatus(w storage.Writer, blockID flow.Identifier, wasUploadCompleted bool) error
UpsertComputationResult upserts given existing instance of ComputationResult in local BadgerDB.
func UpsertLivenessData ¶ added in v0.42.0
func UpsertLivenessData(w storage.Writer, chainID flow.ChainID, livenessData *hotstuff.LivenessData) error
UpsertLivenessData updates liveness data in the database.
func UpsertSafetyData ¶ added in v0.42.0
func UpsertSafetyData(w storage.Writer, chainID flow.ChainID, safetyData *hotstuff.SafetyData) error
UpsertSafetyData inserts safety data into the database.
func UpsertTransaction ¶ added in v0.39.4
func UpsertTransaction(w storage.Writer, txID flow.Identifier, tx *flow.TransactionBody) error
UpsertTransaction inserts a transaction keyed by transaction fingerprint. It overwrites any existing transaction, which is ok because tx is unique by its ID
Types ¶
type BatchLocks ¶ added in v0.41.0
type BatchLocks struct {
// contains filtered or unexported fields
}
BatchLocks is a struct that holds the locks acquired by a batch, which is used to prevent re-entrant deadlock. BatchLocks is not safe for concurrent use by multiple goroutines. Deprecated: BatchLocks exists to provide deadlock protection as a temporary measure during the course of development of the Pebble database layer -- to be replaced prior to release with a system without reliance on globally unique mutex references.
func NewBatchLocks ¶ added in v0.41.0
func NewBatchLocks() *BatchLocks
func (*BatchLocks) Lock ¶ added in v0.41.0
func (l *BatchLocks) Lock(lock *sync.Mutex, callback *Callbacks)
Lock tries to acquire a given lock on behalf of the batch.
If the batch has already acquired this lock earlier (recorded in acquiredLocks), it skips locking again to avoid unnecessary blocking, allowing the caller to proceed immediately.
If the lock has not been acquired yet, it blocks until the lock is acquired, and then records the lock in the acquiredLocks map to indicate ownership.
It also registers a callback to ensure that when the batch operation is finished, the lock is properly released and removed from acquiredLocks.
Parameters:
- lock: The *sync.Mutex to acquire. The common usage of this lock is to prevent dirty reads so that the batch writes is writing the correct data. In other words, this Lock method is to prevent re-entrant deadlock, while this lock mutex is used to prevent dirty reads.
- callback: A Callbacks collection to which the unlock operation is appended so that locks are safely released once the batch processing is complete.
CAUTION: Since locks are identified by pointer address, callers must ensure that no other references exist for the input lock.
type Callbacks ¶
type Callbacks struct {
// contains filtered or unexported fields
}
Callbacks represents a collection of callbacks to be executed. Callbacks are not concurrent safe. Since Callbacks is only used in ReaderBatchWriter, which isn't concurrent safe, there isn't a need to add locking overhead to Callbacks.
func NewCallbacks ¶ added in v0.41.0
func NewCallbacks() *Callbacks
func (*Callbacks) AddCallback ¶
func (*Callbacks) NotifyCallbacks ¶
type CheckFunc ¶
CheckFunc is a function that checks if the value should be read and decoded. return (true, nil) to read the value and pass it to the CreateFunc and HandleFunc for decoding return (false, nil) to skip reading the value return (false, err) if running into any exception, the iteration should be stopped. when making a CheckFunc to be used in the IterationFunc to iterate over the keys, a sentinel error can be defined and checked to stop the iteration early, such as finding the first key that match certain condition. Note: the returned bool is to decide whether to read the value or not, rather than whether to stop the iteration or not.
type CreateFunc ¶
type CreateFunc func() interface{}
CreateFunc returns a pointer to an initialized entity that we can potentially decode the next value into during a badger DB iteration.
type HandleFunc ¶
type HandleFunc func() error
HandleFunc is a function that starts the processing of the current key-value pair during a badger iteration. It should be called after the key was checked and the entity was decoded. No errors are expected during normal operation. Any errors will halt the iteration.
type IterationFunc ¶
type IterationFunc func() (CheckFunc, CreateFunc, HandleFunc)
func KeyOnlyIterateFunc ¶
func KeyOnlyIterateFunc(fn func(key []byte) error) IterationFunc
KeyOnlyIterateFunc returns an IterationFunc that only iterates over keys
Source Files
¶
- approvals.go
- batch_locks.go
- callbacks.go
- chunk_data_packs.go
- chunk_locators.go
- codec.go
- collections.go
- commits.go
- computation_result.go
- consume_progress.go
- events.go
- executed.go
- interactions.go
- jobs.go
- multi_dbstore.go
- multi_iterator.go
- multi_reader.go
- multi_seeker.go
- node_disallow_list.go
- prefix.go
- reads.go
- reads_functors.go
- receipts.go
- results.go
- stats.go
- transaction_results.go
- transactions.go
- version_beacon.go
- views.go
- writes.go
- writes_functors.go