-
Notifications
You must be signed in to change notification settings - Fork 179
/
transaction_results.go
67 lines (50 loc) · 3.48 KB
/
transaction_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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package storage
import "github.com/onflow/flow-go/model/flow"
// TransactionResults represents persistent storage for transaction result
type TransactionResults interface {
// BatchStore inserts a batch of transaction result into a batch
BatchStore(blockID flow.Identifier, transactionResults []flow.TransactionResult, batch BatchStorage) error
// ByBlockIDTransactionID returns the transaction result for the given block ID and transaction ID
ByBlockIDTransactionID(blockID flow.Identifier, transactionID flow.Identifier) (*flow.TransactionResult, error)
// ByBlockIDTransactionIndex returns the transaction result for the given blockID and transaction index
ByBlockIDTransactionIndex(blockID flow.Identifier, txIndex uint32) (*flow.TransactionResult, error)
// ByBlockID gets all transaction results for a block, ordered by transaction index
ByBlockID(id flow.Identifier) ([]flow.TransactionResult, error)
}
// LightTransactionResults represents persistent storage for light transaction result
type LightTransactionResults interface {
// BatchStore inserts a batch of transaction result into a batch
BatchStore(blockID flow.Identifier, transactionResults []flow.LightTransactionResult, batch BatchStorage) error
// ByBlockIDTransactionID returns the transaction result for the given block ID and transaction ID
ByBlockIDTransactionID(blockID flow.Identifier, transactionID flow.Identifier) (*flow.LightTransactionResult, error)
// ByBlockIDTransactionIndex returns the transaction result for the given blockID and transaction index
ByBlockIDTransactionIndex(blockID flow.Identifier, txIndex uint32) (*flow.LightTransactionResult, error)
// ByBlockID gets all transaction results for a block, ordered by transaction index
ByBlockID(id flow.Identifier) ([]flow.LightTransactionResult, error)
}
// TransactionResultErrorMessages represents persistent storage for transaction result error messages
type TransactionResultErrorMessages interface {
// Store will store transaction result error messages for the given block ID.
//
// No errors are expected during normal operation.
Store(blockID flow.Identifier, transactionResultErrorMessages []flow.TransactionResultErrorMessage) error
// Exists returns true if transaction result error messages for the given ID have been stored.
//
// No errors are expected during normal operation.
Exists(blockID flow.Identifier) (bool, error)
// ByBlockIDTransactionID returns the transaction result error message for the given block ID and transaction ID.
//
// Expected errors during normal operation:
// - `storage.ErrNotFound` if no transaction error message is known at given block and transaction id.
ByBlockIDTransactionID(blockID flow.Identifier, transactionID flow.Identifier) (*flow.TransactionResultErrorMessage, error)
// ByBlockIDTransactionIndex returns the transaction result error message for the given blockID and transaction index.
//
// Expected errors during normal operation:
// - `storage.ErrNotFound` if no transaction error message is known at given block and transaction index.
ByBlockIDTransactionIndex(blockID flow.Identifier, txIndex uint32) (*flow.TransactionResultErrorMessage, error)
// ByBlockID gets all transaction result error messages for a block, ordered by transaction index.
// Note: This method will return an empty slice both if the block is not indexed yet and if the block does not have any errors.
//
// No errors are expected during normal operation.
ByBlockID(id flow.Identifier) ([]flow.TransactionResultErrorMessage, error)
}