github.com/koko1123/flow-go-1@v0.29.6/storage/results.go (about)

     1  // (c) 2019 Dapper Labs - ALL RIGHTS RESERVED
     2  
     3  package storage
     4  
     5  import (
     6  	"github.com/koko1123/flow-go-1/model/flow"
     7  	"github.com/koko1123/flow-go-1/storage/badger/transaction"
     8  )
     9  
    10  type ExecutionResults interface {
    11  
    12  	// Store stores an execution result.
    13  	Store(result *flow.ExecutionResult) error
    14  
    15  	// BatchStore stores an execution result in a given batch
    16  	BatchStore(result *flow.ExecutionResult, batch BatchStorage) error
    17  
    18  	// ByID retrieves an execution result by its ID.
    19  	ByID(resultID flow.Identifier) (*flow.ExecutionResult, error)
    20  
    21  	// ByIDTx retrieves an execution result by its ID in the context of the given transaction
    22  	ByIDTx(resultID flow.Identifier) func(*transaction.Tx) (*flow.ExecutionResult, error)
    23  
    24  	// Index indexes an execution result by block ID.
    25  	Index(blockID flow.Identifier, resultID flow.Identifier) error
    26  
    27  	// ForceIndex indexes an execution result by block ID overwriting existing database entry
    28  	ForceIndex(blockID flow.Identifier, resultID flow.Identifier) error
    29  
    30  	// BatchIndex indexes an execution result by block ID in a given batch
    31  	BatchIndex(blockID flow.Identifier, resultID flow.Identifier, batch BatchStorage) error
    32  
    33  	// ByBlockID retrieves an execution result by block ID.
    34  	ByBlockID(blockID flow.Identifier) (*flow.ExecutionResult, error)
    35  
    36  	// BatchRemoveIndexByBlockID removes blockID-to-executionResultID index entries keyed by blockID in a provided batch.
    37  	// No errors are expected during normal operation, even if no entries are matched.
    38  	// If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned.
    39  	BatchRemoveIndexByBlockID(blockID flow.Identifier, batch BatchStorage) error
    40  }