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