-
Notifications
You must be signed in to change notification settings - Fork 179
/
seals.go
59 lines (44 loc) · 2.17 KB
/
seals.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
package operation
import (
"github.com/dgraph-io/badger/v2"
"github.com/onflow/flow-go/model/flow"
)
func InsertSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error {
return insert(makePrefix(codeSeal, sealID), seal)
}
func RetrieveSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error {
return retrieve(makePrefix(codeSeal, sealID), seal)
}
func IndexPayloadSeals(blockID flow.Identifier, sealIDs []flow.Identifier) func(*badger.Txn) error {
return insert(makePrefix(codePayloadSeals, blockID), sealIDs)
}
func LookupPayloadSeals(blockID flow.Identifier, sealIDs *[]flow.Identifier) func(*badger.Txn) error {
return retrieve(makePrefix(codePayloadSeals, blockID), sealIDs)
}
func IndexPayloadReceipts(blockID flow.Identifier, receiptIDs []flow.Identifier) func(*badger.Txn) error {
return insert(makePrefix(codePayloadReceipts, blockID), receiptIDs)
}
func IndexPayloadResults(blockID flow.Identifier, resultIDs []flow.Identifier) func(*badger.Txn) error {
return insert(makePrefix(codePayloadResults, blockID), resultIDs)
}
func LookupPayloadReceipts(blockID flow.Identifier, receiptIDs *[]flow.Identifier) func(*badger.Txn) error {
return retrieve(makePrefix(codePayloadReceipts, blockID), receiptIDs)
}
func LookupPayloadResults(blockID flow.Identifier, resultIDs *[]flow.Identifier) func(*badger.Txn) error {
return retrieve(makePrefix(codePayloadResults, blockID), resultIDs)
}
func IndexBlockSeal(blockID flow.Identifier, sealID flow.Identifier) func(*badger.Txn) error {
return insert(makePrefix(codeBlockToSeal, blockID), sealID)
}
func LookupBlockSeal(blockID flow.Identifier, sealID *flow.Identifier) func(*badger.Txn) error {
return retrieve(makePrefix(codeBlockToSeal, blockID), &sealID)
}
func InsertExecutionForkEvidence(conflictingSeals []*flow.IncorporatedResultSeal) func(*badger.Txn) error {
return insert(makePrefix(codeExecutionFork), conflictingSeals)
}
func RemoveExecutionForkEvidence() func(*badger.Txn) error {
return remove(makePrefix(codeExecutionFork))
}
func RetrieveExecutionForkEvidence(conflictingSeals *[]*flow.IncorporatedResultSeal) func(*badger.Txn) error {
return retrieve(makePrefix(codeExecutionFork), conflictingSeals)
}