Documentation
¶
Index ¶
- 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 IndexCollectionBlock(collID flow.Identifier, blockID flow.Identifier) func(*badger.Txn) error
- func IndexCollectionByTransaction(txID flow.Identifier, collectionID flow.Identifier) func(*badger.Txn) error
- func IndexCollectionPayload(blockID flow.Identifier, txIDs []flow.Identifier) func(*badger.Txn) error
- func IndexReferenceBlockByClusterBlock(clusterBlockID, refID flow.Identifier) 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 InsertEpochFirstHeight(epoch, height uint64) func(*badger.Txn) error
- func InsertExecutedBlock(blockID flow.Identifier) func(*badger.Txn) error
- func InsertExecutionForkEvidence(conflictingSeals []*flow.IncorporatedResultSeal) func(*badger.Txn) error
- func InsertFinalizedHeight(height uint64) func(*badger.Txn) error
- func InsertHeader(headerID flow.Identifier, header *flow.Header) func(*badger.Txn) error
- func InsertJobAtIndex(queue string, index uint64, entity flow.Identifier) 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 InsertPublicDBMarker(txn *badger.Txn) error
- func InsertRootHeight(height uint64) func(*badger.Txn) error
- func InsertSafetyData(chainID flow.ChainID, safetyData *hotstuff.SafetyData) 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 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 LookupCollectionBlock(collID flow.Identifier, blockID *flow.Identifier) func(*badger.Txn) error
- func LookupCollectionPayload(blockID flow.Identifier, txIDs *[]flow.Identifier) func(*badger.Txn) error
- func LookupReferenceBlockByClusterBlock(clusterBlockID flow.Identifier, refID *flow.Identifier) func(*badger.Txn) error
- func MigrateDKGEndStateFromV1(log zerolog.Logger) func(txn *badger.Txn) error
- func PersistBlocklist(blocklist map[flow.Identifier]struct{}) func(*badger.Txn) error
- func PurgeBlocklist() func(*badger.Txn) error
- func RemoveCollection(collID flow.Identifier) func(*badger.Txn) error
- func RemoveExecutionForkEvidence() 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 RetrieveEpochFirstHeight(epoch uint64, height *uint64) func(*badger.Txn) error
- func RetrieveEpochLastHeight(epoch uint64, height *uint64) func(*badger.Txn) error
- func RetrieveExecutedBlock(blockID *flow.Identifier) func(*badger.Txn) error
- func RetrieveExecutionForkEvidence(conflictingSeals *[]*flow.IncorporatedResultSeal) func(*badger.Txn) error
- func RetrieveFinalizedHeight(height *uint64) 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 RetrieveMyBeaconPrivateKey(epochCounter uint64, info *encodable.RandomBeaconPrivKey) func(*badger.Txn) error
- func RetrieveRootHeight(height *uint64) 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 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 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 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 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 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 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 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 InsertFinalizedHeight ¶
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 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 InsertPublicDBMarker ¶ added in v0.22.4
func InsertPublicDBMarker(txn *badger.Txn) error
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 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 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 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 MigrateDKGEndStateFromV1 ¶ added in v0.39.0
MigrateDKGEndStateFromV1 migrates the database that was used in protocol version v1 to the v2. It reads already stored data by deprecated prefix and writes it to the new prefix with values converted to the new representation. TODO(EFM, #6794): This function is introduced to implement a backward-compatible upgrade from v1 to v2. Remove this once we complete the network upgrade.
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 RemoveCollection ¶
func RemoveCollection(collID flow.Identifier) func(*badger.Txn) error
func RemoveExecutionForkEvidence ¶ added in v0.13.0
func RemoveExecutionForkEvidence() func(*badger.Txn) error
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 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 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 RetrieveFinalizedHeight ¶
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 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 RetrieveRootHeight ¶
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 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.