github.com/onflow/flow-go@v0.33.17/engine/access/rpc/backend/backend_execution_results.go (about)

     1  package backend
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/onflow/flow-go/engine/common/rpc"
     7  	"github.com/onflow/flow-go/model/flow"
     8  	"github.com/onflow/flow-go/storage"
     9  )
    10  
    11  type backendExecutionResults struct {
    12  	executionResults storage.ExecutionResults
    13  }
    14  
    15  func (b *backendExecutionResults) GetExecutionResultForBlockID(ctx context.Context, blockID flow.Identifier) (*flow.ExecutionResult, error) {
    16  	result, err := b.executionResults.ByBlockID(blockID)
    17  	if err != nil {
    18  		return nil, rpc.ConvertStorageError(err)
    19  	}
    20  
    21  	return result, nil
    22  }
    23  
    24  // GetExecutionResultByID gets an execution result by its ID.
    25  func (b *backendExecutionResults) GetExecutionResultByID(ctx context.Context, id flow.Identifier) (*flow.ExecutionResult, error) {
    26  	result, err := b.executionResults.ByID(id)
    27  	if err != nil {
    28  		return nil, rpc.ConvertStorageError(err)
    29  	}
    30  
    31  	return result, nil
    32  }