github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/storage/results.go (about) 1 package storage 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 "github.com/onflow/flow-go/storage/badger/transaction" 6 ) 7 8 type ExecutionResults interface { 9 10 // Store stores an execution result. 11 Store(result *flow.ExecutionResult) error 12 13 // BatchStore stores an execution result in a given batch 14 BatchStore(result *flow.ExecutionResult, batch BatchStorage) error 15 16 // ByID retrieves an execution result by its ID. Returns `ErrNotFound` if `resultID` is unknown. 17 ByID(resultID flow.Identifier) (*flow.ExecutionResult, error) 18 19 // ByIDTx returns a functor which retrieves the execution result by its ID, as part of a future database transaction. 20 // When executing the functor, it returns `ErrNotFound` if no execution result with the respective ID is known. 21 ByIDTx(resultID flow.Identifier) func(*transaction.Tx) (*flow.ExecutionResult, error) 22 23 // Index indexes an execution result by block ID. 24 Index(blockID flow.Identifier, resultID flow.Identifier) error 25 26 // ForceIndex indexes an execution result by block ID overwriting existing database entry 27 ForceIndex(blockID flow.Identifier, resultID flow.Identifier) error 28 29 // BatchIndex indexes an execution result by block ID in a given batch 30 BatchIndex(blockID flow.Identifier, resultID flow.Identifier, batch BatchStorage) error 31 32 // ByBlockID retrieves an execution result by block ID. 33 ByBlockID(blockID flow.Identifier) (*flow.ExecutionResult, error) 34 35 // BatchRemoveIndexByBlockID removes blockID-to-executionResultID index entries keyed by blockID in a provided batch. 36 // No errors are expected during normal operation, even if no entries are matched. 37 // If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned. 38 BatchRemoveIndexByBlockID(blockID flow.Identifier, batch BatchStorage) error 39 }