operation

package
v0.34.0-crescendo-prev... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: AGPL-3.0 Imports: 16 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchIndexExecutionReceipts added in v0.15.1

func BatchIndexExecutionReceipts(blockID, receiptID flow.Identifier) func(batch *badger.WriteBatch) error

BatchIndexExecutionReceipts inserts an execution receipt ID keyed by block ID and receipt ID into a batch

func BatchIndexExecutionResult added in v0.15.0

func BatchIndexExecutionResult(blockID flow.Identifier, resultID flow.Identifier) func(batch *badger.WriteBatch) error

BatchIndexExecutionResult inserts an execution result ID keyed by block ID into a batch

func BatchIndexLightTransactionResult added in v0.32.0

func BatchIndexLightTransactionResult(blockID flow.Identifier, txIndex uint32, transactionResult *flow.LightTransactionResult) func(batch *badger.WriteBatch) error

func BatchIndexOwnExecutionReceipt added in v0.15.1

func BatchIndexOwnExecutionReceipt(blockID flow.Identifier, receiptID flow.Identifier) func(batch *badger.WriteBatch) error

BatchIndexOwnExecutionReceipt inserts an execution receipt ID keyed by block ID into a batch TODO: rename to BatchUpdate

func BatchIndexStateCommitment added in v0.15.0

func BatchIndexStateCommitment(blockID flow.Identifier, commit flow.StateCommitment) func(batch *badger.WriteBatch) error

BatchIndexStateCommitment indexes a state commitment into a batch

State commitments are keyed by the block whose execution results in the state with the given commit.

func BatchIndexTransactionResult added in v0.24.8

func BatchIndexTransactionResult(blockID flow.Identifier, txIndex uint32, transactionResult *flow.TransactionResult) func(batch *badger.WriteBatch) error

func BatchInsertChunkDataPack added in v0.15.0

func BatchInsertChunkDataPack(c *badgermodel.StoredChunkDataPack) func(batch *badger.WriteBatch) error

BatchInsertChunkDataPack inserts a chunk data pack keyed by chunk ID into a batch

func BatchInsertEvent added in v0.15.0

func BatchInsertEvent(blockID flow.Identifier, event flow.Event) func(batch *badger.WriteBatch) error

func BatchInsertExecutionReceiptMeta added in v0.15.1

func BatchInsertExecutionReceiptMeta(receiptID flow.Identifier, meta *flow.ExecutionReceiptMeta) func(batch *badger.WriteBatch) error

BatchInsertExecutionReceiptMeta inserts an execution receipt meta by ID. TODO: rename to BatchUpdate

func BatchInsertExecutionResult added in v0.15.0

func BatchInsertExecutionResult(result *flow.ExecutionResult) func(batch *badger.WriteBatch) error

BatchInsertExecutionResult inserts an execution result by ID.

func BatchInsertLightTransactionResult added in v0.32.0

func BatchInsertLightTransactionResult(blockID flow.Identifier, transactionResult *flow.LightTransactionResult) func(batch *badger.WriteBatch) error

func BatchInsertServiceEvent added in v0.15.0

func BatchInsertServiceEvent(blockID flow.Identifier, event flow.Event) func(batch *badger.WriteBatch) error

func BatchInsertTransactionResult added in v0.15.0

func BatchInsertTransactionResult(blockID flow.Identifier, transactionResult *flow.TransactionResult) func(batch *badger.WriteBatch) error

func BatchRemoveChunkDataPack added in v0.30.0

func BatchRemoveChunkDataPack(chunkID flow.Identifier) func(batch *badger.WriteBatch) error

BatchRemoveChunkDataPack removes a chunk data pack keyed by chunk ID, in a batch. No errors are expected during normal operation, even if no entries are matched. If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned.

func BatchRemoveEventsByBlockID added in v0.30.0

func BatchRemoveEventsByBlockID(blockID flow.Identifier, batch *badger.WriteBatch) func(*badger.Txn) error

BatchRemoveEventsByBlockID removes all events for the given blockID. No errors are expected during normal operation, even if no entries are matched. If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned.

func BatchRemoveExecutionResultIndex added in v0.30.0

func BatchRemoveExecutionResultIndex(blockID flow.Identifier) func(*badger.WriteBatch) error

BatchRemoveExecutionResultIndex removes blockID-to-resultID index entries keyed by a blockID in a provided batch. No errors are expected during normal operation, even if no entries are matched. If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned.

func BatchRemoveOwnExecutionReceipt added in v0.30.0

func BatchRemoveOwnExecutionReceipt(blockID flow.Identifier) func(batch *badger.WriteBatch) error

BatchRemoveOwnExecutionReceipt removes blockID-to-my-receiptID index entries keyed by a 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 BatchRemoveServiceEventsByBlockID added in v0.30.0

func BatchRemoveServiceEventsByBlockID(blockID flow.Identifier, batch *badger.WriteBatch) func(*badger.Txn) error

BatchRemoveServiceEventsByBlockID removes all service events for the given blockID. No errors are expected during normal operation, even if no entries are matched. If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned.

func BatchRemoveStateCommitment added in v0.30.0

func BatchRemoveStateCommitment(blockID flow.Identifier) func(batch *badger.WriteBatch) error

BatchRemoveStateCommitment batch removes the state commitment by block ID No errors are expected during normal operation, even if no entries are matched. If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned.

func BatchRemoveTransactionResultsByBlockID added in v0.30.0

func BatchRemoveTransactionResultsByBlockID(blockID flow.Identifier, batch *badger.WriteBatch) func(*badger.Txn) 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 BlockExists added in v0.31.0

func BlockExists(blockID flow.Identifier, blockExists *bool) func(*badger.Txn) error

BlockExists checks whether the block exists in the database. No errors are expected during normal operation.

func CheckEpochEmergencyFallbackTriggered added in v0.23.2

func CheckEpochEmergencyFallbackTriggered(triggered *bool) func(*badger.Txn) error

CheckEpochEmergencyFallbackTriggered retrieves the value of the flag indicating whether epoch emergency fallback has been triggered. If the key is not set, this results in triggered being set to false.

func EnsurePublicDB added in v0.22.4

func EnsurePublicDB(db *badger.DB) error

func EnsureSecretDB added in v0.22.4

func EnsureSecretDB(db *badger.DB) error

func Fail

func Fail(err error) func(*badger.Txn) error

Fail returns a DB operation function that always fails with the given error.

func FindHeaders

func FindHeaders(filter func(header *flow.Header) bool, found *[]flow.Header) func(*badger.Txn) error

FindHeaders iterates through all headers, calling `filter` on each, and adding them to the `found` slice if `filter` returned true

func GetBlockIDsByStatus added in v0.28.0

func GetBlockIDsByStatus(blockIDs *[]flow.Identifier,
	targetUploadStatus bool) func(*badger.Txn) error

GetBlockIDsByStatus returns all IDs of stored ComputationResult instances.

func GetComputationResultUploadStatus added in v0.28.0

func GetComputationResultUploadStatus(blockID flow.Identifier,
	wasUploadCompleted *bool) func(*badger.Txn) error

GetComputationResult returns stored ComputationResult instance with given ID.

func IndexBlockHeight

func IndexBlockHeight(height uint64, blockID flow.Identifier) func(*badger.Txn) error

IndexBlockHeight indexes the height of a block. It should only be called on finalized blocks.

func IndexClusterBlockByReferenceHeight added in v0.25.15

func IndexClusterBlockByReferenceHeight(refHeight uint64, clusterBlockID flow.Identifier) func(*badger.Txn) error

IndexClusterBlockByReferenceHeight indexes a cluster block ID by its reference block height. The cluster block ID is included in the key for more efficient traversal. Only finalized cluster blocks should be included in this index. The key looks like: <prefix 0:1><ref_height 1:9><cluster_block_id 9:41>

func IndexClusterBlockHeight

func IndexClusterBlockHeight(clusterID flow.ChainID, number uint64, blockID flow.Identifier) func(*badger.Txn) error

IndexClusterBlockHeight inserts a block number to block ID mapping for the given cluster.

func IndexCollectionBlock

func IndexCollectionBlock(collID flow.Identifier, blockID flow.Identifier) func(*badger.Txn) error

IndexCollectionBlock indexes a block by a collection within that block.

func IndexCollectionByTransaction

func IndexCollectionByTransaction(txID flow.Identifier, collectionID flow.Identifier) func(*badger.Txn) error

IndexCollectionByTransaction inserts a collection id keyed by a transaction id

func IndexCollectionPayload

func IndexCollectionPayload(blockID flow.Identifier, txIDs []flow.Identifier) func(*badger.Txn) error

IndexCollectionPayload indexes the transactions within the collection payload of a cluster block.

func IndexExecutionReceipts added in v0.15.0

func IndexExecutionReceipts(blockID, receiptID flow.Identifier) func(*badger.Txn) 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

func IndexExecutionResult(blockID flow.Identifier, resultID flow.Identifier) func(*badger.Txn) error

IndexExecutionResult inserts an execution result ID keyed by block ID

func IndexFinalizedSealByBlockID added in v0.26.6

func IndexFinalizedSealByBlockID(sealedBlockID flow.Identifier, sealID flow.Identifier) func(*badger.Txn) error

IndexFinalizedSealByBlockID indexes the _finalized_ seal by the sealed block ID. Example: A <- B <- C(SealA) when block C is finalized, we create the index `A.ID->SealA.ID`

func IndexLatestSealAtBlock added in v0.26.6

func IndexLatestSealAtBlock(blockID flow.Identifier, sealID flow.Identifier) func(*badger.Txn) error

IndexLatestSealAtBlock persists the highest seal that was included in the fork up to (and including) blockID. In most cases, it is the highest seal included in this block's payload. However, if there are no seals in this block, sealID should reference the highest seal in blockID's ancestor.

func IndexOwnExecutionReceipt added in v0.15.0

func IndexOwnExecutionReceipt(blockID flow.Identifier, receiptID flow.Identifier) func(*badger.Txn) error

IndexOwnExecutionReceipt inserts an execution receipt ID keyed by block ID

func IndexPayloadGuarantees

func IndexPayloadGuarantees(blockID flow.Identifier, guarIDs []flow.Identifier) func(*badger.Txn) error

func IndexPayloadProtocolStateID added in v0.33.30

func IndexPayloadProtocolStateID(blockID flow.Identifier, stateID flow.Identifier) func(*badger.Txn) error

func IndexPayloadReceipts added in v0.14.0

func IndexPayloadReceipts(blockID flow.Identifier, receiptIDs []flow.Identifier) func(*badger.Txn) error

func IndexPayloadResults added in v0.16.0

func IndexPayloadResults(blockID flow.Identifier, resultIDs []flow.Identifier) func(*badger.Txn) error

func IndexPayloadSeals

func IndexPayloadSeals(blockID flow.Identifier, sealIDs []flow.Identifier) func(*badger.Txn) error

func IndexProtocolState added in v0.35.4

func IndexProtocolState(blockID flow.Identifier, protocolStateID flow.Identifier) func(*badger.Txn) error

IndexProtocolState indexes a protocol state by block ID. Error returns:

  • storage.ErrAlreadyExists if the key already exists in the database.
  • generic error in case of unexpected failure from the database layer or encoding failure.

func IndexReferenceBlockByClusterBlock added in v0.25.15

func IndexReferenceBlockByClusterBlock(clusterBlockID, refID flow.Identifier) func(*badger.Txn) error

IndexReferenceBlockByClusterBlock inserts the reference block ID for the given cluster block ID. While each cluster block specifies a reference block in its payload, we maintain this additional lookup for performance reasons.

func IndexResultApproval added in v0.14.0

func IndexResultApproval(resultID flow.Identifier, chunkIndex uint64, approvalID flow.Identifier) func(*badger.Txn) error

IndexResultApproval inserts a ResultApproval ID keyed by ExecutionResult ID and chunk index. If a value for this key exists, a storage.ErrAlreadyExists error is returned. This operation is only used by the ResultApprovals store, which is only used within a Verification node, where it is assumed that there is only one approval per chunk.

func IndexStateCommitment

func IndexStateCommitment(blockID flow.Identifier, commit flow.StateCommitment) func(*badger.Txn) error

IndexStateCommitment indexes a state commitment.

State commitments are keyed by the block whose execution results in the state with the given commit.

func IndexVersionBeaconByHeight added in v0.31.0

func IndexVersionBeaconByHeight(
	beacon *flow.SealedVersionBeacon,
) func(*badger.Txn) error

IndexVersionBeaconByHeight stores a sealed version beacon indexed by flow.SealedVersionBeacon.SealHeight.

No errors are expected during normal operation.

func InitJobLatestIndex added in v0.15.0

func InitJobLatestIndex(queue string, index uint64) func(*badger.Txn) error

func InitMax

func InitMax(tx *badger.Txn) error

InitMax retrieves the maximum key length to have it internally in the package after restarting. No errors are expected during normal operation.

func InsertBlockChildren

func InsertBlockChildren(blockID flow.Identifier, childrenIDs flow.IdentifierList) func(*badger.Txn) error

InsertBlockChildren insert an index to lookup the direct child of a block by its ID

func InsertChunkDataPack

func InsertChunkDataPack(c *badgermodel.StoredChunkDataPack) func(*badger.Txn) error

InsertChunkDataPack inserts a chunk data pack keyed by chunk ID.

func InsertChunkLocator added in v0.15.0

func InsertChunkLocator(locator *chunks.Locator) func(*badger.Txn) error

func InsertClusterFinalizedHeight

func InsertClusterFinalizedHeight(clusterID flow.ChainID, number uint64) func(*badger.Txn) error

InsertClusterFinalizedHeight inserts the finalized boundary for the given cluster.

func InsertCollection

func InsertCollection(collection *flow.LightCollection) func(*badger.Txn) error

func InsertComputationResultUploadStatus added in v0.28.0

func InsertComputationResultUploadStatus(blockID flow.Identifier,
	wasUploadCompleted bool) func(*badger.Txn) error

InsertComputationResult addes given instance of ComputationResult into local BadgerDB.

func InsertDKGEndStateForEpoch added in v0.23.9

func InsertDKGEndStateForEpoch(epochCounter uint64, endState flow.DKGEndState) func(*badger.Txn) error

InsertDKGEndStateForEpoch stores the DKG end state for the epoch. Error returns: storage.ErrAlreadyExists

func InsertDKGStartedForEpoch added in v0.23.9

func InsertDKGStartedForEpoch(epochCounter uint64) func(*badger.Txn) error

InsertDKGStartedForEpoch stores a flag indicating that the DKG has been started for the given epoch. Returns: storage.ErrAlreadyExists Error returns: storage.ErrAlreadyExists

func InsertEpochCommit

func InsertEpochCommit(eventID flow.Identifier, event *flow.EpochCommit) func(*badger.Txn) error

func InsertEpochCommitSafetyThreshold added in v0.29.0

func InsertEpochCommitSafetyThreshold(threshold uint64) func(*badger.Txn) error

InsertEpochCommitSafetyThreshold inserts the epoch commit safety threshold for the present spork. A single database and protocol state instance spans at most one spork, and a spork has exactly one protocol version for its duration, so this is inserted exactly once, when bootstrapping the state.

func InsertEpochFirstHeight added in v0.30.0

func InsertEpochFirstHeight(epoch, height uint64) func(*badger.Txn) error

InsertEpochFirstHeight inserts the height of the first block in the given epoch. The first block of an epoch E is the finalized block with view >= E.FirstView. Although we don't store the final height of an epoch, it can be inferred from this index. Returns storage.ErrAlreadyExists if the height has already been indexed.

func InsertEpochSetup

func InsertEpochSetup(eventID flow.Identifier, event *flow.EpochSetup) func(*badger.Txn) error

func InsertEvent

func InsertEvent(blockID flow.Identifier, event flow.Event) func(*badger.Txn) error

func InsertExecutedBlock

func InsertExecutedBlock(blockID flow.Identifier) func(*badger.Txn) error

func InsertExecutionForkEvidence added in v0.13.0

func InsertExecutionForkEvidence(conflictingSeals []*flow.IncorporatedResultSeal) func(*badger.Txn) error

func InsertExecutionReceiptMeta

func InsertExecutionReceiptMeta(receiptID flow.Identifier, meta *flow.ExecutionReceiptMeta) func(*badger.Txn) error

InsertExecutionReceiptMeta inserts an execution receipt meta by ID.

func InsertExecutionResult

func InsertExecutionResult(result *flow.ExecutionResult) func(*badger.Txn) error

InsertExecutionResult inserts an execution result by ID.

func InsertExecutionStateInteractions

func InsertExecutionStateInteractions(
	blockID flow.Identifier,
	executionSnapshots []*snapshot.ExecutionSnapshot,
) func(*badger.Txn) error

func InsertFinalizedHeight

func InsertFinalizedHeight(height uint64) func(*badger.Txn) error

func InsertGuarantee

func InsertGuarantee(collID flow.Identifier, guarantee *flow.CollectionGuarantee) func(*badger.Txn) error

func InsertHeader

func InsertHeader(headerID flow.Identifier, header *flow.Header) func(*badger.Txn) error

func InsertJobAtIndex added in v0.15.0

func InsertJobAtIndex(queue string, index uint64, entity flow.Identifier) func(*badger.Txn) error

InsertJobAtIndex insert an entity ID at the given index

func InsertLastCompleteBlockHeight

func InsertLastCompleteBlockHeight(height uint64) func(*badger.Txn) error

func InsertLastCompleteBlockHeightIfNotExists added in v0.27.3

func InsertLastCompleteBlockHeightIfNotExists(height uint64) func(*badger.Txn) error

InsertLastCompleteBlockHeightIfNotExists inserts the last full block height if it is not already set. Calling this function multiple times is a no-op and returns no expected errors.

func InsertLightTransactionResult added in v0.32.0

func InsertLightTransactionResult(blockID flow.Identifier, transactionResult *flow.LightTransactionResult) func(*badger.Txn) error

func InsertLivenessData added in v0.29.0

func InsertLivenessData(chainID flow.ChainID, livenessData *hotstuff.LivenessData) func(*badger.Txn) error

InsertLivenessData inserts liveness data into the database.

func InsertMyBeaconPrivateKey added in v0.23.2

func InsertMyBeaconPrivateKey(epochCounter uint64, info *encodable.RandomBeaconPrivKey) func(*badger.Txn) error

InsertMyBeaconPrivateKey stores the random beacon private key for the given epoch.

CAUTION: This method stores confidential information and should only be used in the context of the secrets database. This is enforced in the above layer (see storage.DKGState). Error returns: storage.ErrAlreadyExists

func InsertProcessedIndex added in v0.15.0

func InsertProcessedIndex(jobName string, processed uint64) func(*badger.Txn) error

func InsertProtocolState added in v0.35.4

func InsertProtocolState(protocolStateID flow.Identifier, protocolState *flow.ProtocolStateEntry) func(*badger.Txn) error

InsertProtocolState inserts a protocol state by ID. Error returns:

  • storage.ErrAlreadyExists if the key already exists in the database.
  • generic error in case of unexpected failure from the database layer or encoding failure.

func InsertProtocolVersion added in v0.23.2

func InsertProtocolVersion(version uint) func(*badger.Txn) error

InsertProtocolVersion inserts the protocol version for the present spork. A single database and protocol state instance spans at most one spork, and a spork has exactly one protocol version for its duration, so this is inserted exactly once, when bootstrapping the state.

func InsertPublicDBMarker added in v0.22.4

func InsertPublicDBMarker(txn *badger.Txn) error

func InsertQuorumCertificate added in v0.30.0

func InsertQuorumCertificate(qc *flow.QuorumCertificate) func(*badger.Txn) error

InsertQuorumCertificate inserts a quorum certificate by block ID. Returns storage.ErrAlreadyExists if a QC has already been inserted for the block.

func InsertResultApproval added in v0.14.0

func InsertResultApproval(approval *flow.ResultApproval) func(*badger.Txn) error

InsertResultApproval inserts a ResultApproval by ID.

func InsertRootHeight

func InsertRootHeight(height uint64) func(*badger.Txn) error

func InsertSafetyData added in v0.29.0

func InsertSafetyData(chainID flow.ChainID, safetyData *hotstuff.SafetyData) func(*badger.Txn) error

InsertSafetyData inserts safety data into the database.

func InsertSeal

func InsertSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error

func InsertSealedHeight

func InsertSealedHeight(height uint64) func(*badger.Txn) error

func InsertSealedRootHeight added in v0.30.7

func InsertSealedRootHeight(height uint64) func(*badger.Txn) error

func InsertSecretDBMarker added in v0.22.4

func InsertSecretDBMarker(txn *badger.Txn) error

func InsertServiceEvent added in v0.14.0

func InsertServiceEvent(blockID flow.Identifier, event flow.Event) func(*badger.Txn) error

func InsertSporkID added in v0.23.2

func InsertSporkID(sporkID flow.Identifier) func(*badger.Txn) error

InsertSporkID inserts the spork ID for the present spork. A single database and protocol state instance spans at most one spork, so this is inserted exactly once, when bootstrapping the state.

func InsertSporkRootBlockHeight added in v0.29.6

func InsertSporkRootBlockHeight(height uint64) func(*badger.Txn) error

InsertSporkRootBlockHeight inserts the spork root block height for the present spork. A single database and protocol state instance spans at most one spork, so this is inserted exactly once, when bootstrapping the state.

func InsertTransaction

func InsertTransaction(txID flow.Identifier, tx *flow.TransactionBody) func(*badger.Txn) error

InsertTransaction inserts a transaction keyed by transaction fingerprint.

func InsertTransactionResult

func InsertTransactionResult(blockID flow.Identifier, transactionResult *flow.TransactionResult) func(*badger.Txn) error

func LookupBlockHeight

func LookupBlockHeight(height uint64, blockID *flow.Identifier) func(*badger.Txn) error

LookupBlockHeight retrieves finalized blocks by height.

func LookupBySealedBlockID added in v0.26.6

func LookupBySealedBlockID(sealedBlockID flow.Identifier, sealID *flow.Identifier) func(*badger.Txn) error

LookupBySealedBlockID finds the seal for the given sealed block ID.

func LookupClusterBlockHeight

func LookupClusterBlockHeight(clusterID flow.ChainID, number uint64, blockID *flow.Identifier) func(*badger.Txn) error

LookupClusterBlockHeight retrieves a block ID by number for the given cluster

func LookupClusterBlocksByReferenceHeightRange added in v0.25.15

func LookupClusterBlocksByReferenceHeightRange(start, end uint64, clusterBlockIDs *[]flow.Identifier) func(*badger.Txn) error

LookupClusterBlocksByReferenceHeightRange traverses the ref_height->cluster_block index and returns any finalized cluster blocks which have a reference block with height in the given range. This is used to avoid including duplicate transaction when building or validating a new collection.

func LookupCollectionBlock

func LookupCollectionBlock(collID flow.Identifier, blockID *flow.Identifier) func(*badger.Txn) error

LookupCollectionBlock looks up a block by a collection within that block.

func LookupCollectionPayload

func LookupCollectionPayload(blockID flow.Identifier, txIDs *[]flow.Identifier) func(*badger.Txn) error

LookupCollection looks up the collection for a given cluster payload.

func LookupEventsByBlockID

func LookupEventsByBlockID(blockID flow.Identifier, events *[]flow.Event) func(*badger.Txn) error

func LookupEventsByBlockIDEventType

func LookupEventsByBlockIDEventType(blockID flow.Identifier, eventType flow.EventType, events *[]flow.Event) func(*badger.Txn) error

func LookupExecutionReceipts added in v0.15.0

func LookupExecutionReceipts(blockID flow.Identifier, receiptIDs *[]flow.Identifier) func(*badger.Txn) error

LookupExecutionReceipts finds all execution receipts by block ID

func LookupExecutionResult

func LookupExecutionResult(blockID flow.Identifier, resultID *flow.Identifier) func(*badger.Txn) error

LookupExecutionResult finds execution result ID by block

func LookupLastVersionBeaconByHeight added in v0.31.0

func LookupLastVersionBeaconByHeight(
	maxHeight uint64,
	versionBeacon *flow.SealedVersionBeacon,
) func(*badger.Txn) error

LookupLastVersionBeaconByHeight finds the highest flow.VersionBeacon but no higher than maxHeight. Returns storage.ErrNotFound if no version beacon exists at or below the given height.

func LookupLatestSealAtBlock added in v0.26.6

func LookupLatestSealAtBlock(blockID flow.Identifier, sealID *flow.Identifier) func(*badger.Txn) error

LookupLatestSealAtBlock finds the highest seal that was included in the fork up to (and including) blockID. In most cases, it is the highest seal included in this block's payload. However, if there are no seals in this block, sealID should reference the highest seal in blockID's ancestor.

func LookupLightTransactionResultsByBlockIDUsingIndex added in v0.32.0

func LookupLightTransactionResultsByBlockIDUsingIndex(blockID flow.Identifier, txResults *[]flow.LightTransactionResult) func(*badger.Txn) 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.15.0

func LookupOwnExecutionReceipt(blockID flow.Identifier, receiptID *flow.Identifier) func(*badger.Txn) error

LookupOwnExecutionReceipt finds execution receipt ID by block

func LookupPayloadGuarantees

func LookupPayloadGuarantees(blockID flow.Identifier, guarIDs *[]flow.Identifier) func(*badger.Txn) error

func LookupPayloadProtocolStateID added in v0.33.30

func LookupPayloadProtocolStateID(blockID flow.Identifier, stateID *flow.Identifier) func(*badger.Txn) error

func LookupPayloadReceipts added in v0.14.0

func LookupPayloadReceipts(blockID flow.Identifier, receiptIDs *[]flow.Identifier) func(*badger.Txn) error

func LookupPayloadResults added in v0.16.0

func LookupPayloadResults(blockID flow.Identifier, resultIDs *[]flow.Identifier) func(*badger.Txn) error

func LookupPayloadSeals

func LookupPayloadSeals(blockID flow.Identifier, sealIDs *[]flow.Identifier) func(*badger.Txn) error

func LookupProtocolState added in v0.35.4

func LookupProtocolState(blockID flow.Identifier, protocolStateID *flow.Identifier) func(*badger.Txn) error

LookupProtocolState finds protocol state ID by block ID. Error returns:

  • storage.ErrNotFound if the key does not exist in the database
  • generic error in case of unexpected failure from the database layer

func LookupReferenceBlockByClusterBlock added in v0.25.15

func LookupReferenceBlockByClusterBlock(clusterBlockID flow.Identifier, refID *flow.Identifier) func(*badger.Txn) error

LookupReferenceBlockByClusterBlock looks up the reference block ID for the given cluster block ID. While each cluster block specifies a reference block in its payload, we maintain this additional lookup for performance reasons.

func LookupResultApproval added in v0.14.0

func LookupResultApproval(resultID flow.Identifier, chunkIndex uint64, approvalID *flow.Identifier) func(*badger.Txn) error

LookupResultApproval finds a ResultApproval by result ID and chunk index.

func LookupServiceEventsByBlockID added in v0.14.0

func LookupServiceEventsByBlockID(blockID flow.Identifier, events *[]flow.Event) func(*badger.Txn) error

func LookupStateCommitment

func LookupStateCommitment(blockID flow.Identifier, commit *flow.StateCommitment) func(*badger.Txn) 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 LookupTransactionResultsByBlockIDUsingIndex added in v0.24.11

func LookupTransactionResultsByBlockIDUsingIndex(blockID flow.Identifier, txResults *[]flow.TransactionResult) func(*badger.Txn) error

LookupTransactionResultsByBlockIDUsingIndex retrieves all tx results for a block, by using tx_index index. This correctly handles cases of duplicate transactions within block.

func PersistBlocklist added in v0.28.0

func PersistBlocklist(blocklist map[flow.Identifier]struct{}) func(*badger.Txn) error

PersistBlocklist writes the set of blocked nodes IDs into the data base. 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 PurgeBlocklist added in v0.28.0

func PurgeBlocklist() func(*badger.Txn) error

PurgeBlocklist removes the set of blocked nodes IDs from the data base. 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 ReindexExecutionResult added in v0.21.0

func ReindexExecutionResult(blockID flow.Identifier, resultID flow.Identifier) func(*badger.Txn) error

ReindexExecutionResult updates mapping of an execution result ID keyed by block ID

func RemoveChunkDataPack

func RemoveChunkDataPack(chunkID flow.Identifier) func(*badger.Txn) error

RemoveChunkDataPack removes the chunk data pack with the given chunk ID.

func RemoveCollection

func RemoveCollection(collID flow.Identifier) func(*badger.Txn) error

func RemoveComputationResultUploadStatus added in v0.28.0

func RemoveComputationResultUploadStatus(
	blockID flow.Identifier) func(*badger.Txn) error

RemoveComputationResult removes an instance of ComputationResult with given ID.

func RemoveEventsByBlockID added in v0.26.0

func RemoveEventsByBlockID(blockID flow.Identifier) func(*badger.Txn) error

func RemoveExecutionForkEvidence added in v0.13.0

func RemoveExecutionForkEvidence() func(*badger.Txn) error

func RemoveExecutionResultIndex added in v0.26.0

func RemoveExecutionResultIndex(blockID flow.Identifier) func(*badger.Txn) error

RemoveExecutionResultIndex removes execution result indexed by the given blockID

func RemoveOwnExecutionReceipt added in v0.26.0

func RemoveOwnExecutionReceipt(blockID flow.Identifier) func(*badger.Txn) error

RemoveOwnExecutionReceipt removes own execution receipt index by blockID

func RemoveServiceEventsByBlockID added in v0.26.0

func RemoveServiceEventsByBlockID(blockID flow.Identifier) func(*badger.Txn) error

func RemoveStateCommitment added in v0.24.5

func RemoveStateCommitment(blockID flow.Identifier) func(*badger.Txn) error

RemoveStateCommitment removes the state commitment by block ID

func RemoveTransactionResultsByBlockID added in v0.24.5

func RemoveTransactionResultsByBlockID(blockID flow.Identifier) func(*badger.Txn) error

RemoveTransactionResultsByBlockID removes the transaction results for the given blockID

func RetrieveBlockChildren

func RetrieveBlockChildren(blockID flow.Identifier, childrenIDs *flow.IdentifierList) func(*badger.Txn) error

RetrieveBlockChildren the child block ID by parent block ID

func RetrieveBlocklist added in v0.28.0

func RetrieveBlocklist(blocklist *map[flow.Identifier]struct{}) func(*badger.Txn) error

RetrieveBlocklist reads the set of blocked node IDs from the data base. Returns `storage.ErrNotFound` error in case no respective data base entry is present.

TODO: TEMPORARY manual override for adding node IDs to list of ejected nodes, applies to networking layer only

func RetrieveChunkDataPack

func RetrieveChunkDataPack(chunkID flow.Identifier, c *badgermodel.StoredChunkDataPack) func(*badger.Txn) error

RetrieveChunkDataPack retrieves a chunk data pack by chunk ID.

func RetrieveChunkLocator added in v0.15.0

func RetrieveChunkLocator(locatorID flow.Identifier, locator *chunks.Locator) func(*badger.Txn) error

func RetrieveClusterFinalizedHeight

func RetrieveClusterFinalizedHeight(clusterID flow.ChainID, number *uint64) func(*badger.Txn) error

RetrieveClusterFinalizedHeight retrieves the finalized boundary for the given cluster.

func RetrieveCollection

func RetrieveCollection(collID flow.Identifier, collection *flow.LightCollection) func(*badger.Txn) error

func RetrieveCollectionID

func RetrieveCollectionID(txID flow.Identifier, collectionID *flow.Identifier) func(*badger.Txn) error

LookupCollectionID retrieves a collection id by transaction id

func RetrieveDKGEndStateForEpoch added in v0.23.9

func RetrieveDKGEndStateForEpoch(epochCounter uint64, endState *flow.DKGEndState) func(*badger.Txn) error

RetrieveDKGEndStateForEpoch retrieves the DKG end state for the epoch. Error returns: storage.ErrNotFound

func RetrieveDKGStartedForEpoch added in v0.23.9

func RetrieveDKGStartedForEpoch(epochCounter uint64, started *bool) func(*badger.Txn) error

RetrieveDKGStartedForEpoch retrieves the DKG started flag for the given epoch. If no flag is set, started is set to false and no error is returned. No errors expected during normal operation.

func RetrieveEpochCommit

func RetrieveEpochCommit(eventID flow.Identifier, event *flow.EpochCommit) func(*badger.Txn) error

func RetrieveEpochCommitSafetyThreshold added in v0.29.0

func RetrieveEpochCommitSafetyThreshold(threshold *uint64) func(*badger.Txn) error

RetrieveEpochCommitSafetyThreshold retrieves the epoch commit safety threshold for the present spork.

func RetrieveEpochEmergencyFallbackTriggeredBlockID added in v0.23.2

func RetrieveEpochEmergencyFallbackTriggeredBlockID(blockID *flow.Identifier) func(*badger.Txn) error

RetrieveEpochEmergencyFallbackTriggeredBlockID gets the block ID where epoch emergency was triggered.

func RetrieveEpochFirstHeight added in v0.30.0

func RetrieveEpochFirstHeight(epoch uint64, height *uint64) func(*badger.Txn) error

RetrieveEpochFirstHeight retrieves the height of the first block in the given epoch. Returns storage.ErrNotFound if the first block of the epoch has not yet been finalized.

func RetrieveEpochLastHeight added in v0.31.0

func RetrieveEpochLastHeight(epoch uint64, height *uint64) func(*badger.Txn) error

RetrieveEpochLastHeight retrieves the height of the last block in the given epoch. It's a more readable, but equivalent query to RetrieveEpochFirstHeight when interested in the last height of an epoch. Returns storage.ErrNotFound if the first block of the epoch has not yet been finalized.

func RetrieveEpochSetup

func RetrieveEpochSetup(eventID flow.Identifier, event *flow.EpochSetup) func(*badger.Txn) error

func RetrieveEvents

func RetrieveEvents(blockID flow.Identifier, transactionID flow.Identifier, events *[]flow.Event) func(*badger.Txn) error

func RetrieveExecutedBlock

func RetrieveExecutedBlock(blockID *flow.Identifier) func(*badger.Txn) error

func RetrieveExecutionForkEvidence added in v0.13.0

func RetrieveExecutionForkEvidence(conflictingSeals *[]*flow.IncorporatedResultSeal) func(*badger.Txn) error

func RetrieveExecutionReceiptMeta

func RetrieveExecutionReceiptMeta(receiptID flow.Identifier, meta *flow.ExecutionReceiptMeta) func(*badger.Txn) error

RetrieveExecutionReceiptMeta retrieves a execution receipt meta by ID.

func RetrieveExecutionResult

func RetrieveExecutionResult(resultID flow.Identifier, result *flow.ExecutionResult) func(*badger.Txn) error

RetrieveExecutionResult retrieves a transaction by fingerprint.

func RetrieveExecutionStateInteractions

func RetrieveExecutionStateInteractions(
	blockID flow.Identifier,
	executionSnapshots *[]*snapshot.ExecutionSnapshot,
) func(*badger.Txn) error

func RetrieveFinalizedHeight

func RetrieveFinalizedHeight(height *uint64) func(*badger.Txn) error

func RetrieveGuarantee

func RetrieveGuarantee(collID flow.Identifier, guarantee *flow.CollectionGuarantee) func(*badger.Txn) error

func RetrieveHeader

func RetrieveHeader(blockID flow.Identifier, header *flow.Header) func(*badger.Txn) error

func RetrieveJobAtIndex added in v0.15.0

func RetrieveJobAtIndex(queue string, index uint64, entity *flow.Identifier) func(*badger.Txn) error

RetrieveJobAtIndex returns the entity at the given index

func RetrieveJobLatestIndex added in v0.15.0

func RetrieveJobLatestIndex(queue string, index *uint64) func(*badger.Txn) error

func RetrieveLastCompleteBlockHeight

func RetrieveLastCompleteBlockHeight(height *uint64) func(*badger.Txn) error

func RetrieveLightTransactionResult added in v0.32.0

func RetrieveLightTransactionResult(blockID flow.Identifier, transactionID flow.Identifier, transactionResult *flow.LightTransactionResult) func(*badger.Txn) error

func RetrieveLightTransactionResultByIndex added in v0.32.0

func RetrieveLightTransactionResultByIndex(blockID flow.Identifier, txIndex uint32, transactionResult *flow.LightTransactionResult) func(*badger.Txn) error

func RetrieveLivenessData added in v0.29.0

func RetrieveLivenessData(chainID flow.ChainID, livenessData *hotstuff.LivenessData) func(*badger.Txn) error

RetrieveLivenessData retrieves liveness data from the database.

func RetrieveMyBeaconPrivateKey added in v0.23.2

func RetrieveMyBeaconPrivateKey(epochCounter uint64, info *encodable.RandomBeaconPrivKey) func(*badger.Txn) error

RetrieveMyBeaconPrivateKey retrieves the random beacon private key for the given epoch.

CAUTION: This method stores confidential information and should only be used in the context of the secrets database. This is enforced in the above layer (see storage.DKGState). Error returns: storage.ErrNotFound

func RetrieveProcessedIndex added in v0.15.0

func RetrieveProcessedIndex(jobName string, processed *uint64) func(*badger.Txn) error

RetrieveProcessedIndex returns the processed index for a job consumer

func RetrieveProtocolState added in v0.35.4

func RetrieveProtocolState(protocolStateID flow.Identifier, protocolState *flow.ProtocolStateEntry) func(*badger.Txn) error

RetrieveProtocolState retrieves a protocol state by ID. Error returns:

  • storage.ErrNotFound if the key does not exist in the database
  • generic error in case of unexpected failure from the database layer

func RetrieveProtocolVersion added in v0.23.2

func RetrieveProtocolVersion(version *uint) func(*badger.Txn) error

RetrieveProtocolVersion retrieves the protocol version for the present spork.

func RetrieveQuorumCertificate added in v0.30.0

func RetrieveQuorumCertificate(blockID flow.Identifier, qc *flow.QuorumCertificate) func(*badger.Txn) error

RetrieveQuorumCertificate retrieves a quorum certificate by blockID. Returns storage.ErrNotFound if no QC is stored for the block.

func RetrieveResultApproval added in v0.14.0

func RetrieveResultApproval(approvalID flow.Identifier, approval *flow.ResultApproval) func(*badger.Txn) error

RetrieveResultApproval retrieves an approval by ID.

func RetrieveRootHeight

func RetrieveRootHeight(height *uint64) func(*badger.Txn) error

func RetrieveSafetyData added in v0.29.0

func RetrieveSafetyData(chainID flow.ChainID, safetyData *hotstuff.SafetyData) func(*badger.Txn) error

RetrieveSafetyData retrieves safety data from the database.

func RetrieveSeal

func RetrieveSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error

func RetrieveSealedHeight

func RetrieveSealedHeight(height *uint64) func(*badger.Txn) error

func RetrieveSealedRootHeight added in v0.30.7

func RetrieveSealedRootHeight(height *uint64) func(*badger.Txn) error

func RetrieveSporkID added in v0.23.2

func RetrieveSporkID(sporkID *flow.Identifier) func(*badger.Txn) error

RetrieveSporkID retrieves the spork ID for the present spork.

func RetrieveSporkRootBlockHeight added in v0.29.6

func RetrieveSporkRootBlockHeight(height *uint64) func(*badger.Txn) error

RetrieveSporkRootBlockHeight retrieves the spork root block height for the present spork.

func RetrieveTransaction

func RetrieveTransaction(txID flow.Identifier, tx *flow.TransactionBody) func(*badger.Txn) error

RetrieveTransaction retrieves a transaction by fingerprint.

func RetrieveTransactionResult

func RetrieveTransactionResult(blockID flow.Identifier, transactionID flow.Identifier, transactionResult *flow.TransactionResult) func(*badger.Txn) error

func RetrieveTransactionResultByIndex added in v0.24.8

func RetrieveTransactionResultByIndex(blockID flow.Identifier, txIndex uint32, transactionResult *flow.TransactionResult) func(*badger.Txn) error

func RetryOnConflict

func RetryOnConflict(action func(func(*badger.Txn) error) error, op func(tx *badger.Txn) error) error

func RetryOnConflictTx added in v0.17.0

func RetryOnConflictTx(db *badger.DB, action func(*badger.DB, func(*transaction.Tx) error) error, op func(*transaction.Tx) error) error

func SetEpochEmergencyFallbackTriggered added in v0.23.2

func SetEpochEmergencyFallbackTriggered(blockID flow.Identifier) func(txn *badger.Txn) error

SetEpochEmergencyFallbackTriggered sets a flag in the DB indicating that epoch emergency fallback has been triggered, and the block where it was triggered.

EFM can be triggered in two ways:

  1. Finalizing the first block past the epoch commitment deadline, when the next epoch has not yet been committed (see protocol.Params for more detail)
  2. Finalizing a fork in which an invalid service event was incorporated.

Calling this function multiple times is a no-op and returns no expected errors.

func SetJobLatestIndex added in v0.15.0

func SetJobLatestIndex(queue string, index uint64) func(*badger.Txn) error

func SetMax

func SetMax(tx storage.Transaction) error

SetMax sets the value for the maximum key length used for efficient iteration. No errors are expected during normal operation.

func SetProcessedIndex added in v0.15.0

func SetProcessedIndex(jobName string, processed uint64) func(*badger.Txn) error

SetProcessedIndex updates the processed index for a job consumer with given index

func SkipDuplicates

func SkipDuplicates(op func(*badger.Txn) error) func(tx *badger.Txn) error

func SkipDuplicatesTx added in v0.33.30

func SkipDuplicatesTx(op func(*transaction.Tx) error) func(tx *transaction.Tx) error

func SkipNonExist added in v0.24.5

func SkipNonExist(op func(*badger.Txn) error) func(tx *badger.Txn) error

func UpdateBlockChildren

func UpdateBlockChildren(blockID flow.Identifier, childrenIDs flow.IdentifierList) func(*badger.Txn) error

UpdateBlockChildren updates the children for a block.

func UpdateClusterFinalizedHeight

func UpdateClusterFinalizedHeight(clusterID flow.ChainID, number uint64) func(*badger.Txn) error

UpdateClusterFinalizedHeight updates the finalized boundary for the given cluster.

func UpdateComputationResultUploadStatus added in v0.28.0

func UpdateComputationResultUploadStatus(blockID flow.Identifier,
	wasUploadCompleted bool) func(*badger.Txn) error

UpdateComputationResult updates given existing instance of ComputationResult in local BadgerDB.

func UpdateExecutedBlock

func UpdateExecutedBlock(blockID flow.Identifier) func(*badger.Txn) error

func UpdateFinalizedHeight

func UpdateFinalizedHeight(height uint64) func(*badger.Txn) error

func UpdateLastCompleteBlockHeight

func UpdateLastCompleteBlockHeight(height uint64) func(*badger.Txn) error

func UpdateLivenessData added in v0.29.0

func UpdateLivenessData(chainID flow.ChainID, livenessData *hotstuff.LivenessData) func(*badger.Txn) error

UpdateLivenessData updates liveness data in the database.

func UpdateSafetyData added in v0.29.0

func UpdateSafetyData(chainID flow.ChainID, safetyData *hotstuff.SafetyData) func(*badger.Txn) error

UpdateSafetyData updates safety data in the database.

func UpdateSealedHeight

func UpdateSealedHeight(height uint64) func(*badger.Txn) error

func UpsertComputationResultUploadStatus added in v0.28.0

func UpsertComputationResultUploadStatus(blockID flow.Identifier,
	wasUploadCompleted bool) func(*badger.Txn) error

UpsertComputationResult upserts given existing instance of ComputationResult in local BadgerDB.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL