Documentation
¶
Index ¶
- func BatchIndexExecutionReceipts(blockID, receiptID flow.Identifier) func(batch *badger.WriteBatch) error
- func BatchIndexExecutionResult(blockID flow.Identifier, resultID flow.Identifier) func(batch *badger.WriteBatch) error
- func BatchIndexOwnExecutionReceipt(blockID flow.Identifier, receiptID flow.Identifier) func(batch *badger.WriteBatch) error
- func BatchInsertExecutionReceiptStub(receiptID flow.Identifier, stub *flow.ExecutionReceiptStub) func(batch *badger.WriteBatch) error
- func BatchInsertExecutionResult(result *flow.ExecutionResult) func(batch *badger.WriteBatch) error
- func BatchRemoveExecutionResultIndex(blockID flow.Identifier) func(*badger.WriteBatch) error
- func BatchRemoveOwnExecutionReceipt(blockID flow.Identifier) func(batch *badger.WriteBatch) error
- func BlockExists(blockID flow.Identifier, blockExists *bool) func(*badger.Txn) error
- func EnsurePublicDB(db *badger.DB) error
- func EnsureSecretDB(db *badger.DB) error
- func Fail(err error) func(*badger.Txn) error
- func FindHeaders(filter func(header *flow.Header) bool, found *[]flow.Header) func(*badger.Txn) error
- func IndexBlockHeight(height uint64, blockID flow.Identifier) func(*badger.Txn) error
- func IndexClusterBlockByReferenceHeight(refHeight uint64, clusterBlockID flow.Identifier) func(*badger.Txn) error
- func IndexClusterBlockHeight(clusterID flow.ChainID, number uint64, blockID flow.Identifier) func(*badger.Txn) error
- func IndexCollectionByTransaction(txID flow.Identifier, collectionID flow.Identifier) func(*badger.Txn) error
- func IndexCollectionGuaranteeBlock(collID flow.Identifier, blockID flow.Identifier) func(*badger.Txn) error
- func IndexCollectionPayload(blockID flow.Identifier, txIDs []flow.Identifier) func(*badger.Txn) error
- func IndexEpochProtocolState(blockID flow.Identifier, epochProtocolStateEntryID flow.Identifier) func(*badger.Txn) error
- func IndexExecutionReceipts(blockID, receiptID flow.Identifier) func(*badger.Txn) error
- func IndexExecutionResult(blockID flow.Identifier, resultID flow.Identifier) func(*badger.Txn) error
- func IndexFinalizedSealByBlockID(sealedBlockID flow.Identifier, sealID flow.Identifier) func(*badger.Txn) error
- func IndexGuarantee(collectionID flow.Identifier, guaranteeID flow.Identifier) func(*badger.Txn) error
- func IndexLatestSealAtBlock(blockID flow.Identifier, sealID flow.Identifier) func(*badger.Txn) error
- func IndexOwnExecutionReceipt(blockID flow.Identifier, receiptID flow.Identifier) func(*badger.Txn) error
- func IndexPayloadGuarantees(blockID flow.Identifier, guarIDs []flow.Identifier) func(*badger.Txn) error
- func IndexPayloadProtocolStateID(blockID flow.Identifier, stateID flow.Identifier) func(*badger.Txn) error
- func IndexPayloadReceipts(blockID flow.Identifier, receiptIDs []flow.Identifier) func(*badger.Txn) error
- func IndexPayloadResults(blockID flow.Identifier, resultIDs []flow.Identifier) func(*badger.Txn) error
- func IndexPayloadSeals(blockID flow.Identifier, sealIDs []flow.Identifier) func(*badger.Txn) error
- func IndexProtocolKVStore(blockID flow.Identifier, protocolKVStoreID flow.Identifier) func(*badger.Txn) error
- func IndexReferenceBlockByClusterBlock(clusterBlockID, refID flow.Identifier) func(*badger.Txn) error
- func IndexSporkRootBlock(blockID flow.Identifier) func(*badger.Txn) error
- func IndexVersionBeaconByHeight(beacon *flow.SealedVersionBeacon) func(*badger.Txn) error
- func InitJobLatestIndex(queue string, index uint64) func(*badger.Txn) error
- func InitMax(tx *badger.Txn) error
- func InsertBlockChildren(blockID flow.Identifier, childrenIDs flow.IdentifierList) func(*badger.Txn) error
- func InsertClusterFinalizedHeight(clusterID flow.ChainID, number uint64) func(*badger.Txn) error
- func InsertCollection(collection *flow.LightCollection) func(*badger.Txn) error
- func InsertEpochCommit(eventID flow.Identifier, event *flow.EpochCommit) func(*badger.Txn) error
- func InsertEpochFirstHeight(epoch, height uint64) func(*badger.Txn) error
- func InsertEpochProtocolState(entryID flow.Identifier, entry *flow.MinEpochStateEntry) func(*badger.Txn) error
- func InsertEpochSetup(eventID flow.Identifier, event *flow.EpochSetup) func(*badger.Txn) error
- func InsertExecutedBlock(blockID flow.Identifier) func(*badger.Txn) error
- func InsertExecutionForkEvidence(conflictingSeals []*flow.IncorporatedResultSeal) func(*badger.Txn) error
- func InsertExecutionReceiptStub(receiptID flow.Identifier, stub *flow.ExecutionReceiptStub) func(*badger.Txn) error
- func InsertExecutionResult(result *flow.ExecutionResult) func(*badger.Txn) error
- func InsertFinalizedHeight(height uint64) func(*badger.Txn) error
- func InsertGuarantee(guaranteeID flow.Identifier, guarantee *flow.CollectionGuarantee) func(*badger.Txn) error
- func InsertHeader(blockID flow.Identifier, header *flow.Header) func(*badger.Txn) error
- func InsertJobAtIndex(queue string, index uint64, entity flow.Identifier) func(*badger.Txn) error
- func InsertLastCompleteBlockHeight(height uint64) func(*badger.Txn) error
- func InsertLastCompleteBlockHeightIfNotExists(height uint64) func(*badger.Txn) error
- func InsertLivenessData(chainID flow.ChainID, livenessData *hotstuff.LivenessData) func(*badger.Txn) error
- func InsertMyBeaconPrivateKey(epochCounter uint64, info *encodable.RandomBeaconPrivKey) func(*badger.Txn) error
- func InsertProposalSignature(blockID flow.Identifier, sig *[]byte) func(*badger.Txn) error
- func InsertProtocolKVStore(protocolKVStoreID flow.Identifier, kvStore *flow.PSKeyValueStoreData) func(*badger.Txn) error
- func InsertPublicDBMarker(txn *badger.Txn) error
- func InsertQuorumCertificate(qc *flow.QuorumCertificate) func(*badger.Txn) error
- func InsertRootHeight(height uint64) func(*badger.Txn) error
- func InsertSafetyData(chainID flow.ChainID, safetyData *hotstuff.SafetyData) func(*badger.Txn) error
- func InsertSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error
- func InsertSealedHeight(height uint64) func(*badger.Txn) error
- func InsertSealedRootHeight(height uint64) func(*badger.Txn) error
- func InsertSecretDBMarker(txn *badger.Txn) error
- func InsertTransaction(txID flow.Identifier, tx *flow.TransactionBody) func(*badger.Txn) error
- func LookupBlockHeight(height uint64, blockID *flow.Identifier) func(*badger.Txn) error
- func LookupBySealedBlockID(sealedBlockID flow.Identifier, sealID *flow.Identifier) func(*badger.Txn) error
- func LookupClusterBlockHeight(clusterID flow.ChainID, number uint64, blockID *flow.Identifier) func(*badger.Txn) error
- func LookupClusterBlocksByReferenceHeightRange(start, end uint64, clusterBlockIDs *[]flow.Identifier) func(*badger.Txn) error
- func LookupCollectionGuaranteeBlock(collID flow.Identifier, blockID *flow.Identifier) func(*badger.Txn) error
- func LookupCollectionPayload(blockID flow.Identifier, txIDs *[]flow.Identifier) func(*badger.Txn) error
- func LookupEpochProtocolState(blockID flow.Identifier, epochProtocolStateEntryID *flow.Identifier) func(*badger.Txn) error
- func LookupExecutionReceipts(blockID flow.Identifier, receiptIDs *[]flow.Identifier) func(*badger.Txn) error
- func LookupExecutionResult(blockID flow.Identifier, resultID *flow.Identifier) func(*badger.Txn) error
- func LookupGuarantee(collectionID flow.Identifier, guaranteeID *flow.Identifier) func(*badger.Txn) error
- func LookupLastVersionBeaconByHeight(maxHeight uint64, versionBeacon *flow.SealedVersionBeacon) func(*badger.Txn) error
- func LookupLatestSealAtBlock(blockID flow.Identifier, sealID *flow.Identifier) func(*badger.Txn) error
- func LookupOwnExecutionReceipt(blockID flow.Identifier, receiptID *flow.Identifier) func(*badger.Txn) error
- func LookupPayloadGuarantees(blockID flow.Identifier, guarIDs *[]flow.Identifier) func(*badger.Txn) error
- func LookupPayloadProtocolStateID(blockID flow.Identifier, stateID *flow.Identifier) func(*badger.Txn) error
- func LookupPayloadReceipts(blockID flow.Identifier, receiptIDs *[]flow.Identifier) func(*badger.Txn) error
- func LookupPayloadResults(blockID flow.Identifier, resultIDs *[]flow.Identifier) func(*badger.Txn) error
- func LookupPayloadSeals(blockID flow.Identifier, sealIDs *[]flow.Identifier) func(*badger.Txn) error
- func LookupProtocolKVStore(blockID flow.Identifier, protocolKVStoreID *flow.Identifier) func(*badger.Txn) error
- func LookupReferenceBlockByClusterBlock(clusterBlockID flow.Identifier, refID *flow.Identifier) func(*badger.Txn) error
- func PersistBlocklist(blocklist map[flow.Identifier]struct{}) func(*badger.Txn) error
- func PurgeBlocklist() func(*badger.Txn) error
- func ReindexExecutionResult(blockID flow.Identifier, resultID flow.Identifier) func(*badger.Txn) error
- func RemoveCollection(collID flow.Identifier) func(*badger.Txn) error
- func RemoveExecutionForkEvidence() func(*badger.Txn) error
- func RemoveExecutionResultIndex(blockID flow.Identifier) func(*badger.Txn) error
- func RemoveOwnExecutionReceipt(blockID flow.Identifier) func(*badger.Txn) error
- func RetrieveBlockChildren(blockID flow.Identifier, childrenIDs *flow.IdentifierList) func(*badger.Txn) error
- func RetrieveBlocklist(blocklist *map[flow.Identifier]struct{}) func(*badger.Txn) error
- func RetrieveClusterFinalizedHeight(clusterID flow.ChainID, number *uint64) func(*badger.Txn) error
- func RetrieveCollection(collID flow.Identifier, collection *flow.LightCollection) func(*badger.Txn) error
- func RetrieveCollectionID(txID flow.Identifier, collectionID *flow.Identifier) func(*badger.Txn) error
- func RetrieveDKGStartedForEpoch(epochCounter uint64, started *bool) func(*badger.Txn) error
- func RetrieveDKGStateForEpoch(epochCounter uint64, currentState *flow.DKGState) func(*badger.Txn) error
- func RetrieveEpochCommit(eventID flow.Identifier, event *flow.EpochCommit) func(*badger.Txn) error
- func RetrieveEpochFirstHeight(epoch uint64, height *uint64) func(*badger.Txn) error
- func RetrieveEpochLastHeight(epoch uint64, height *uint64) func(*badger.Txn) error
- func RetrieveEpochProtocolState(entryID flow.Identifier, entry *flow.MinEpochStateEntry) func(*badger.Txn) error
- func RetrieveEpochSetup(eventID flow.Identifier, event *flow.EpochSetup) func(*badger.Txn) error
- func RetrieveExecutedBlock(blockID *flow.Identifier) func(*badger.Txn) error
- func RetrieveExecutionForkEvidence(conflictingSeals *[]*flow.IncorporatedResultSeal) func(*badger.Txn) error
- func RetrieveExecutionReceiptStub(receiptID flow.Identifier, stub *flow.ExecutionReceiptStub) func(*badger.Txn) error
- func RetrieveExecutionResult(resultID flow.Identifier, result *flow.ExecutionResult) func(*badger.Txn) error
- func RetrieveFinalizedHeight(height *uint64) func(*badger.Txn) error
- func RetrieveGuarantee(guaranteeID flow.Identifier, guarantee *flow.CollectionGuarantee) func(*badger.Txn) error
- func RetrieveHeader(blockID flow.Identifier, header *flow.Header) func(*badger.Txn) error
- func RetrieveJobAtIndex(queue string, index uint64, entity *flow.Identifier) func(*badger.Txn) error
- func RetrieveJobLatestIndex(queue string, index *uint64) func(*badger.Txn) error
- func RetrieveLastCompleteBlockHeight(height *uint64) func(*badger.Txn) error
- func RetrieveMyBeaconPrivateKey(epochCounter uint64, info *encodable.RandomBeaconPrivKey) func(*badger.Txn) error
- func RetrieveProposalSignature(blockID flow.Identifier, sig *[]byte) func(*badger.Txn) error
- func RetrieveProtocolKVStore(protocolKVStoreID flow.Identifier, kvStore *flow.PSKeyValueStoreData) func(*badger.Txn) error
- func RetrieveQuorumCertificate(blockID flow.Identifier, qc *flow.QuorumCertificate) func(*badger.Txn) error
- func RetrieveRootHeight(height *uint64) func(*badger.Txn) error
- func RetrieveSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error
- func RetrieveSealedHeight(height *uint64) func(*badger.Txn) error
- func RetrieveSealedRootHeight(height *uint64) func(*badger.Txn) error
- func RetrieveSporkRootBlockID(blockID *flow.Identifier) func(*badger.Txn) error
- func RetrieveTransaction(txID flow.Identifier, tx *flow.TransactionBody) func(*badger.Txn) error
- func RetryOnConflict(action func(func(*badger.Txn) error) error, op func(tx *badger.Txn) error) error
- func RetryOnConflictTx(db *badger.DB, action func(*badger.DB, func(*transaction.Tx) error) error, ...) error
- func SetJobLatestIndex(queue string, index uint64) func(*badger.Txn) error
- func SetMax(tx storage.Transaction) error
- func SkipDuplicates(op func(*badger.Txn) error) func(tx *badger.Txn) error
- func SkipDuplicatesTx(op func(*transaction.Tx) error) func(tx *transaction.Tx) error
- func SkipNonExist(op func(*badger.Txn) error) func(tx *badger.Txn) error
- func UpdateBlockChildren(blockID flow.Identifier, childrenIDs flow.IdentifierList) func(*badger.Txn) error
- func UpdateClusterFinalizedHeight(clusterID flow.ChainID, number uint64) func(*badger.Txn) error
- func UpdateExecutedBlock(blockID flow.Identifier) func(*badger.Txn) error
- func UpdateFinalizedHeight(height uint64) func(*badger.Txn) error
- func UpdateLastCompleteBlockHeight(height uint64) func(*badger.Txn) error
- func UpdateSealedHeight(height uint64) func(*badger.Txn) error
- func UpsertDKGStateForEpoch(epochCounter uint64, newState flow.DKGState) func(*badger.Txn) error
- func UpsertMyBeaconPrivateKey(epochCounter uint64, info *encodable.RandomBeaconPrivKey) func(*badger.Txn) error
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 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 BatchInsertExecutionReceiptStub ¶
func BatchInsertExecutionReceiptStub(receiptID flow.Identifier, stub *flow.ExecutionReceiptStub) func(batch *badger.WriteBatch) error
BatchInsertExecutionReceiptStub inserts an execution receipt stub 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 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 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 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 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 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 IndexCollectionByTransaction ¶
func IndexCollectionByTransaction(txID flow.Identifier, collectionID flow.Identifier) func(*badger.Txn) error
IndexCollectionByTransaction inserts a collection id keyed by a transaction id
func IndexCollectionGuaranteeBlock ¶
func IndexCollectionGuaranteeBlock(collID flow.Identifier, blockID flow.Identifier) func(*badger.Txn) error
IndexCollectionGuaranteeBlock indexes a block by a collection guarantee within that block.
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 IndexEpochProtocolState ¶ added in v0.33.30
func IndexEpochProtocolState(blockID flow.Identifier, epochProtocolStateEntryID flow.Identifier) func(*badger.Txn) error
IndexEpochProtocolState indexes an epoch protocol state entry 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 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 IndexGuarantee ¶
func IndexGuarantee(collectionID flow.Identifier, guaranteeID flow.Identifier) func(*badger.Txn) error
IndexGuarantee indexes a collection guarantee by collection ID. Error returns:
- storage.ErrAlreadyExists if the key already exists in the database.
- generic error in case of unexpected failure from the database layer
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
IndexPayloadGuarantees indexes a collection guarantees 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
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 IndexProtocolKVStore ¶ added in v0.33.30
func IndexProtocolKVStore(blockID flow.Identifier, protocolKVStoreID flow.Identifier) func(*badger.Txn) error
IndexProtocolKVStore indexes a protocol KV store 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
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 IndexSporkRootBlock ¶
func IndexSporkRootBlock(blockID flow.Identifier) func(*badger.Txn) error
IndexSporkRootBlock indexes the spork root block 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 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. deprecated, this is still needed by the state/protocol/badger/mutator.go
func InitJobLatestIndex ¶ added in v0.15.0
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 InsertClusterFinalizedHeight ¶
InsertClusterFinalizedHeight inserts the finalized boundary for the given cluster.
func InsertCollection ¶
func InsertCollection(collection *flow.LightCollection) func(*badger.Txn) error
func InsertEpochCommit ¶
func InsertEpochCommit(eventID flow.Identifier, event *flow.EpochCommit) func(*badger.Txn) error
func InsertEpochFirstHeight ¶ added in v0.30.0
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 InsertEpochProtocolState ¶ added in v0.33.30
func InsertEpochProtocolState(entryID flow.Identifier, entry *flow.MinEpochStateEntry) func(*badger.Txn) error
InsertEpochProtocolState inserts an epoch protocol state entry 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 InsertEpochSetup ¶
func InsertEpochSetup(eventID flow.Identifier, event *flow.EpochSetup) 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 InsertExecutionReceiptStub ¶
func InsertExecutionReceiptStub(receiptID flow.Identifier, stub *flow.ExecutionReceiptStub) func(*badger.Txn) error
InsertExecutionReceiptStub inserts an execution receipt stub by ID.
func InsertExecutionResult ¶
func InsertExecutionResult(result *flow.ExecutionResult) func(*badger.Txn) error
InsertExecutionResult inserts an execution result by ID.
func InsertFinalizedHeight ¶
func InsertGuarantee ¶
func InsertGuarantee(guaranteeID flow.Identifier, guarantee *flow.CollectionGuarantee) func(*badger.Txn) error
InsertGuarantee inserts a collection guarantee 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 InsertHeader ¶
func InsertHeader(blockID flow.Identifier, header *flow.Header) func(*badger.Txn) error
InsertHeader inserts a header 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 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 InsertLastCompleteBlockHeightIfNotExists ¶ added in v0.27.3
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 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. Deprecated: this function will be replaced by `operation.UpsertLivenessData` from the `storage/operation` package when moving to Pebble
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 InsertProposalSignature ¶
func InsertProposalSignature(blockID flow.Identifier, sig *[]byte) func(*badger.Txn) error
InsertProposalSignature inserts a proposal signature by block ID. Returns storage.ErrAlreadyExists if a proposal signature has already been inserted for the block.
func InsertProtocolKVStore ¶ added in v0.33.30
func InsertProtocolKVStore(protocolKVStoreID flow.Identifier, kvStore *flow.PSKeyValueStoreData) func(*badger.Txn) error
InsertProtocolKVStore inserts a protocol KV store 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 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 InsertRootHeight ¶
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. Deprecated: this function will be replaced by `operation.UpsertSafetyData` from the `storage/operation` package when moving to Pebble
func InsertSeal ¶
func InsertSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error
func InsertSealedHeight ¶
func InsertSealedRootHeight ¶ added in v0.30.7
func InsertSecretDBMarker ¶ added in v0.22.4
func InsertSecretDBMarker(txn *badger.Txn) error
func InsertTransaction ¶
func InsertTransaction(txID flow.Identifier, tx *flow.TransactionBody) func(*badger.Txn) error
InsertTransaction inserts a transaction keyed by transaction fingerprint.
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 LookupCollectionGuaranteeBlock ¶
func LookupCollectionGuaranteeBlock(collID flow.Identifier, blockID *flow.Identifier) func(*badger.Txn) error
LookupCollectionGuaranteeBlock looks up a block by a collection guarantee 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 LookupEpochProtocolState ¶ added in v0.33.30
func LookupEpochProtocolState(blockID flow.Identifier, epochProtocolStateEntryID *flow.Identifier) func(*badger.Txn) error
LookupEpochProtocolState finds an epoch protocol state entry 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 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 LookupGuarantee ¶
func LookupGuarantee(collectionID flow.Identifier, guaranteeID *flow.Identifier) func(*badger.Txn) error
LookupGuarantee finds collection guarantee ID by collection 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 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 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
LookupPayloadGuarantees finds collection guarantees 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 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 LookupProtocolKVStore ¶ added in v0.33.30
func LookupProtocolKVStore(blockID flow.Identifier, protocolKVStoreID *flow.Identifier) func(*badger.Txn) error
LookupProtocolKVStore finds protocol KV store 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 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 RemoveCollection ¶
func RemoveCollection(collID 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 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 RetrieveClusterFinalizedHeight ¶
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 RetrieveDKGStartedForEpoch ¶ added in v0.23.9
RetrieveDKGStartedForEpoch retrieves whether DKG has started 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 RetrieveDKGStateForEpoch ¶ added in v0.39.0
func RetrieveDKGStateForEpoch(epochCounter uint64, currentState *flow.DKGState) func(*badger.Txn) error
RetrieveDKGStateForEpoch retrieves the current DKG state for the epoch. Error returns: storage.ErrNotFound
func RetrieveEpochCommit ¶
func RetrieveEpochCommit(eventID flow.Identifier, event *flow.EpochCommit) func(*badger.Txn) error
func RetrieveEpochFirstHeight ¶ added in v0.30.0
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
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 RetrieveEpochProtocolState ¶ added in v0.33.30
func RetrieveEpochProtocolState(entryID flow.Identifier, entry *flow.MinEpochStateEntry) func(*badger.Txn) error
RetrieveEpochProtocolState retrieves an epoch protocol state entry 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 RetrieveEpochSetup ¶
func RetrieveEpochSetup(eventID flow.Identifier, event *flow.EpochSetup) 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 RetrieveExecutionReceiptStub ¶
func RetrieveExecutionReceiptStub(receiptID flow.Identifier, stub *flow.ExecutionReceiptStub) func(*badger.Txn) error
RetrieveExecutionReceiptStub retrieves a execution receipt stub by ID.
func RetrieveExecutionResult ¶
func RetrieveExecutionResult(resultID flow.Identifier, result *flow.ExecutionResult) func(*badger.Txn) error
RetrieveExecutionResult retrieves a transaction by fingerprint.
func RetrieveFinalizedHeight ¶
func RetrieveGuarantee ¶
func RetrieveGuarantee(guaranteeID flow.Identifier, guarantee *flow.CollectionGuarantee) func(*badger.Txn) error
RetrieveGuarantee retrieves a collection guarantee 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 RetrieveHeader ¶
func RetrieveHeader(blockID flow.Identifier, header *flow.Header) func(*badger.Txn) error
RetrieveHeader retrieves a header 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 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 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 RetrieveProposalSignature ¶
func RetrieveProposalSignature(blockID flow.Identifier, sig *[]byte) func(*badger.Txn) error
RetrieveProposalSignature retrieves a proposal signature by blockID. Returns storage.ErrNotFound if no proposal signature is stored for the block.
func RetrieveProtocolKVStore ¶ added in v0.33.30
func RetrieveProtocolKVStore(protocolKVStoreID flow.Identifier, kvStore *flow.PSKeyValueStoreData) func(*badger.Txn) error
RetrieveProtocolKVStore retrieves a protocol KV store 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 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 RetrieveRootHeight ¶
func RetrieveSeal ¶
func RetrieveSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error
func RetrieveSealedHeight ¶
func RetrieveSealedRootHeight ¶ added in v0.30.7
func RetrieveSporkRootBlockID ¶
func RetrieveSporkRootBlockID(blockID *flow.Identifier) func(*badger.Txn) error
RetrieveSporkRootBlockID retrieves the spork root block ID 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 RetryOnConflict ¶
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 SetJobLatestIndex ¶ added in v0.15.0
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 SkipDuplicates ¶
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 UpdateBlockChildren ¶
func UpdateBlockChildren(blockID flow.Identifier, childrenIDs flow.IdentifierList) func(*badger.Txn) error
UpdateBlockChildren updates the children for a block.
func UpdateClusterFinalizedHeight ¶
UpdateClusterFinalizedHeight updates the finalized boundary for the given cluster.
func UpdateExecutedBlock ¶
func UpdateExecutedBlock(blockID flow.Identifier) func(*badger.Txn) error
func UpdateFinalizedHeight ¶
func UpdateSealedHeight ¶
func UpsertDKGStateForEpoch ¶ added in v0.39.0
UpsertDKGStateForEpoch stores the current state of Random Beacon Recoverable State Machine for the epoch, irrespective of whether an entry for the given epoch counter already exists in the database or not.
func UpsertMyBeaconPrivateKey ¶ added in v0.39.0
func UpsertMyBeaconPrivateKey(epochCounter uint64, info *encodable.RandomBeaconPrivKey) func(*badger.Txn) error
UpsertMyBeaconPrivateKey stores the random beacon private key, irrespective of whether an entry for the given epoch counter already exists in the database or not.
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.EpochRecoveryMyBeaconKey). This method has to be used only in very specific cases, like epoch recovery, for normal usage use InsertMyBeaconPrivateKey.
Types ¶
This section is empty.