Documentation ¶
Index ¶
- Variables
- type All
- type Blocks
- type ChunkDataPacks
- type Cleaner
- type ClusterBlocks
- type ClusterPayloads
- type Collections
- type Commits
- type EpochCommits
- type EpochSetups
- type EpochStatuses
- type Events
- type ExecutionReceipts
- type ExecutionResults
- type Guarantees
- type Headers
- type Identities
- type Index
- type Ledger
- type LedgerVerifier
- type Payloads
- type ResultApprovals
- type Seals
- type ServiceEvents
- type TransactionResults
- type Transactions
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type All ¶ added in v0.12.0
type All struct { Headers Headers Guarantees Guarantees Seals Seals Index Index Payloads Payloads Blocks Blocks Setups EpochSetups EpochCommits EpochCommits Statuses EpochStatuses Results ExecutionResults Receipts ExecutionReceipts ChunkDataPacks ChunkDataPacks Commits Commits Transactions Transactions TransactionResults TransactionResults Collections Collections Events Events }
All includes all the storage modules
type Blocks ¶
type Blocks interface { // Store will atomically store a block with all its dependencies. Store(block *flow.Block) error // StoreTx allows us to store a new block, including its payload & header, as part of a DB transaction, while // still going through the caching layer. StoreTx(block *flow.Block) func(*badger.Txn) error // ByID returns the block with the given hash. It is available for // finalized and ambiguous blocks. ByID(blockID flow.Identifier) (*flow.Block, error) // ByHeight returns the block at the given height. It is only available // for finalized blocks. ByHeight(height uint64) (*flow.Block, error) // ByCollectionID returns the block for the given collection ID. ByCollectionID(collID flow.Identifier) (*flow.Block, error) // IndexBlockForCollections indexes the block each collection was // included in. IndexBlockForCollections(blockID flow.Identifier, collIDs []flow.Identifier) error // UpdateLastFullBlockHeight updates the FullBlockHeight index // The FullBlockHeight index indicates that block for which all collections have been received UpdateLastFullBlockHeight(height uint64) error // GetLastFullBlockHeight retrieves the FullBlockHeight GetLastFullBlockHeight() (height uint64, err error) }
Blocks represents persistent storage for blocks.
type ChunkDataPacks ¶
type ChunkDataPacks interface { // Store inserts the chunk header, keyed by chunk ID. Store(c *flow.ChunkDataPack) error // Remove removes the chunk data for the given chunk ID, if it exists. Remove(chunkID flow.Identifier) error // ByChunkID returns the chunk data for the given a chunk ID. ByChunkID(chunkID flow.Identifier) (*flow.ChunkDataPack, error) }
ChunkDataPacks represents persistent storage for chunk data packs.
type ClusterBlocks ¶
type ClusterBlocks interface { // Store stores the cluster block. Store(block *cluster.Block) error // ByID returns the block with the given ID. ByID(blockID flow.Identifier) (*cluster.Block, error) // ByHeight returns the block with the given height. Only available for // finalized blocks. ByHeight(height uint64) (*cluster.Block, error) }
type ClusterPayloads ¶
type ClusterPayloads interface { // Store stores and indexes the given cluster payload. Store(blockID flow.Identifier, payload *cluster.Payload) error // ByBlockID returns the cluster payload for the given block ID. ByBlockID(blockID flow.Identifier) (*cluster.Payload, error) }
ClusterPayloads handles storing and retrieving payloads for collection node cluster consensus.
type Collections ¶
type Collections interface { // StoreLight inserts the collection. It does not insert, nor check // existence of, the constituent transactions. StoreLight(collection *flow.LightCollection) error // Store inserts the collection keyed by ID and all constituent // transactions. Store(collection *flow.Collection) error // Remove removes the collection and all constituent transactions. Remove(collID flow.Identifier) error // LightByID returns collection with the given ID. Only retrieves // transaction hashes. LightByID(collID flow.Identifier) (*flow.LightCollection, error) // ByID returns the collection with the given ID, including all // transactions within the collection. ByID(collID flow.Identifier) (*flow.Collection, error) // StoreLightAndIndexByTransaction inserts the light collection (only // transaction IDs) and adds a transaction id index for each of the // transactions within the collection (transaction_id->collection_id). // // NOTE: Currently it is possible in rare circumstances for two collections // to be guaranteed which both contain the same transaction (see https://github.com/dapperlabs/flow-go/issues/3556). // The second of these will revert upon reaching the execution node, so // this doesn't impact the execution state, but it can result in the Access // node processing two collections which both contain the same transaction (see https://github.com/dapperlabs/flow-go/issues/5337). // To handle this, we skip indexing the affected transaction when inserting // the transaction_id->collection_id index when an index for the transaction // already exists. StoreLightAndIndexByTransaction(collection *flow.LightCollection) error // LightByTransactionID returns the collection for the given transaction ID. Only retrieves // transaction hashes. LightByTransactionID(txID flow.Identifier) (*flow.LightCollection, error) }
Collections represents persistent storage for collections.
type Commits ¶
type Commits interface { // Store will store a commit in the persistent storage. Store(blockID flow.Identifier, commit flow.StateCommitment) error // ByBlockID will retrieve a commit by its ID from persistent storage. ByBlockID(blockID flow.Identifier) (flow.StateCommitment, error) }
Commits represents persistent storage for state commitments.
type EpochCommits ¶
type EpochCommits interface { // StoreTx allows us to store a new epoch commit in a DB transaction while updating the cache. StoreTx(commit *flow.EpochCommit) func(*badger.Txn) error // ByCommitID will return the EpochCommit event by its ID. ByID(flow.Identifier) (*flow.EpochCommit, error) }
type EpochSetups ¶
type EpochSetups interface { // StoreTx allows us to store a new epoch setup in a DB transaction while going through the cache. StoreTx(*flow.EpochSetup) func(*badger.Txn) error // ByID will return the EpochSetup event by its ID. ByID(flow.Identifier) (*flow.EpochSetup, error) }
type EpochStatuses ¶
type EpochStatuses interface { // StoreTx stores a new epoch state in a DB transaction while going through the cache. StoreTx(blockID flow.Identifier, state *flow.EpochStatus) func(*badger.Txn) error // ByBlockID will return the epoch status for the given block ByBlockID(flow.Identifier) (*flow.EpochStatus, error) }
type Events ¶
type Events interface { // Store will store events for the given block ID Store(blockID flow.Identifier, events []flow.Event) error // ByBlockID returns the events for the given block ID ByBlockID(blockID flow.Identifier) ([]flow.Event, error) // ByBlockIDTransactionID returns the events for the given block ID and transaction ID ByBlockIDTransactionID(blockID flow.Identifier, transactionID flow.Identifier) ([]flow.Event, error) // ByBlockIDEventType returns the events for the given block ID and event type ByBlockIDEventType(blockID flow.Identifier, eventType flow.EventType) ([]flow.Event, error) }
Events represents persistent storage for events.
type ExecutionReceipts ¶
type ExecutionReceipts interface { // Store stores an execution receipt. Store(result *flow.ExecutionReceipt) error // ByID retrieves an execution receipt by its ID. ByID(resultID flow.Identifier) (*flow.ExecutionReceipt, error) // Index indexes an execution receipt by block ID. Index(blockID flow.Identifier, resultID flow.Identifier) error // IndexByExecutor indexes an execution receipt by block ID and execution ID IndexByExecutor(receipt *flow.ExecutionReceipt) error // ByBlockID retrieves an execution receipt by block ID. ByBlockID(blockID flow.Identifier) (*flow.ExecutionReceipt, error) // ByBlockIDAllExecutionReceipts retrieves all execution receipts for a block ID ByBlockIDAllExecutionReceipts(blockID flow.Identifier) ([]*flow.ExecutionReceipt, error) }
type ExecutionResults ¶
type ExecutionResults interface { // Store stores an execution result. Store(result *flow.ExecutionResult) error // ByID retrieves an execution result by its ID. ByID(resultID flow.Identifier) (*flow.ExecutionResult, error) // Index indexes an execution result by block ID. Index(blockID flow.Identifier, resultID flow.Identifier) error // ByBlockID retrieves an execution result by block ID. ByBlockID(blockID flow.Identifier) (*flow.ExecutionResult, error) }
type Guarantees ¶
type Guarantees interface { // Store inserts the collection guarantee. Store(guarantee *flow.CollectionGuarantee) error // ByCollectionID retrieves the collection guarantee by collection ID. ByCollectionID(collID flow.Identifier) (*flow.CollectionGuarantee, error) }
Guarantees represents persistent storage for collection guarantees.
type Headers ¶
type Headers interface { // Store will store a header. Store(header *flow.Header) error // ByBlockID returns the header with the given ID. It is available for // finalized and ambiguous blocks. ByBlockID(blockID flow.Identifier) (*flow.Header, error) // ByHeight returns the block with the given number. It is only available // for finalized blocks. ByHeight(height uint64) (*flow.Header, error) // Find all children for the given parent block. The returned headers might // be unfinalized; if there is more than one, at least one of them has to // be unfinalized. ByParentID(parentID flow.Identifier) ([]*flow.Header, error) }
Headers represents persistent storage for blocks.
type Identities ¶
type Identities interface { // Store will store the given identity. Store(identity *flow.Identity) error // ByNodeID will retrieve the identity for a node. ByNodeID(nodeID flow.Identifier) (*flow.Identity, error) }
Identities represents the simple storage for identities.
type Index ¶
type Index interface { // Store stores the index for a block payload. Store(blockID flow.Identifier, index *flow.Index) error // ByBlockID retrieves the index for a block payload. ByBlockID(blockID flow.Identifier) (*flow.Index, error) }
type Ledger ¶
type Ledger interface { module.ReadyDoneAware EmptyStateCommitment() flow.StateCommitment // Trusted methods (without proof) // Get registers at specific StateCommitment by a list of register ids GetRegisters(registerIDs []flow.RegisterID, stateCommitment flow.StateCommitment) (values []flow.RegisterValue, err error) // Batched atomic updates of a subset of registers at specific state UpdateRegisters(registerIDs []flow.RegisterID, values []flow.RegisterValue, stateCommitment flow.StateCommitment) (newStateCommitment flow.StateCommitment, err error) // Untrusted methods (providing proofs) // Get registers at specific StateCommitment by a list of register ids with proofs GetRegistersWithProof(registerIDs []flow.RegisterID, stateCommitment flow.StateCommitment) (values []flow.RegisterValue, proofs []flow.StorageProof, err error) // Batched atomic updates of a subset of registers at specific state with proofs UpdateRegistersWithProof(registerIDs []flow.RegisterID, values []flow.RegisterValue, stateCommitment flow.StateCommitment) (newStateCommitment flow.StateCommitment, proofs []flow.StorageProof, err error) DiskSize() (int64, error) }
Ledger takes care of storing registers (key, value pairs) providing proof of correctness we aim to store a state of the order of 10^10 registers with up to 1M historic state versions
type LedgerVerifier ¶
type LedgerVerifier interface { // verify if a provided proof for getRegisters is accurate VerifyRegistersProof(registerIDs []flow.RegisterID, stateCommitment flow.StateCommitment, values []flow.RegisterValue, proof []flow.StorageProof) (verified bool, err error) }
LedgerVerifier should be designed as an standalone package to verify proofs of storage
type Payloads ¶
type Payloads interface { // Store will store a payload and index its contents. Store(blockID flow.Identifier, payload *flow.Payload) error // ByBlockID returns the payload with the given hash. It is available for // finalized and ambiguous blocks. ByBlockID(blockID flow.Identifier) (*flow.Payload, error) }
Payloads represents persistent storage for payloads.
type ResultApprovals ¶ added in v0.14.0
type ResultApprovals interface { // Store stores a ResultApproval Store(result *flow.ResultApproval) error // Index indexes a ResultApproval by result ID and chunk index Index(resultID flow.Identifier, chunkIndex uint64, approvalID flow.Identifier) error // ByID retrieves a ResultApproval by its ID ByID(approvalID flow.Identifier) (*flow.ResultApproval, error) // ByChunk retrieves a ResultApproval by result ID and chunk index ByChunk(resultID flow.Identifier, chunkIndex uint64) (*flow.ResultApproval, error) }
type Seals ¶
type Seals interface { // Store inserts the seal. Store(seal *flow.Seal) error // ByID retrieves the seal by the collection // fingerprint. ByID(sealID flow.Identifier) (*flow.Seal, error) // ByBlockID retrieves the last seal in the chain of seals for the block. ByBlockID(sealedID flow.Identifier) (*flow.Seal, error) }
Seals represents persistent storage for seals.
type ServiceEvents ¶ added in v0.14.0
type ServiceEvents interface { // Store will store events marked as service events for the given block ID Store(blockID flow.Identifier, events []flow.Event) error // ByBlockID returns the events for the given block ID ByBlockID(blockID flow.Identifier) ([]flow.Event, error) }
type TransactionResults ¶
type TransactionResults interface { // Store inserts the transaction result Store(blockID flow.Identifier, transactionResult *flow.TransactionResult) error // BatchStore inserts a batch of transaction result BatchStore(blockID flow.Identifier, transactionResults []flow.TransactionResult) error // ByBlockIDTransactionID returns the transaction result for the given block ID and transaction ID ByBlockIDTransactionID(blockID flow.Identifier, transactionID flow.Identifier) (*flow.TransactionResult, error) }
TransactionResults represents persistent storage for transaction result
type Transactions ¶
type Transactions interface { // Store inserts the transaction, keyed by fingerprint. Duplicate transaction insertion is ignored Store(tx *flow.TransactionBody) error // ByID returns the transaction for the given fingerprint. ByID(txID flow.Identifier) (*flow.TransactionBody, error) }
Transactions represents persistent storage for transactions.
Source Files ¶
- all.go
- approvals.go
- blocks.go
- chunkDataPacks.go
- cleaner.go
- cluster_blocks.go
- cluster_payloads.go
- collections.go
- commits.go
- epoch_commits.go
- epoch_setups.go
- epoch_statuses.go
- errors.go
- events.go
- guarantees.go
- headers.go
- identities.go
- index.go
- ledger.go
- payloads.go
- receipts.go
- results.go
- seals.go
- transaction_results.go
- transactions.go