-
Notifications
You must be signed in to change notification settings - Fork 176
/
heights.go
51 lines (38 loc) · 1.5 KB
/
heights.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
// (c) 2019 Dapper Labs - ALL RIGHTS RESERVED
package operation
import (
"github.com/dgraph-io/badger/v2"
)
func InsertRootHeight(height uint64) func(*badger.Txn) error {
return insert(makePrefix(codeRootHeight), height)
}
func RetrieveRootHeight(height *uint64) func(*badger.Txn) error {
return retrieve(makePrefix(codeRootHeight), height)
}
func InsertFinalizedHeight(height uint64) func(*badger.Txn) error {
return insert(makePrefix(codeFinalizedHeight), height)
}
func UpdateFinalizedHeight(height uint64) func(*badger.Txn) error {
return update(makePrefix(codeFinalizedHeight), height)
}
func RetrieveFinalizedHeight(height *uint64) func(*badger.Txn) error {
return retrieve(makePrefix(codeFinalizedHeight), height)
}
func InsertSealedHeight(height uint64) func(*badger.Txn) error {
return insert(makePrefix(codeSealedHeight), height)
}
func UpdateSealedHeight(height uint64) func(*badger.Txn) error {
return update(makePrefix(codeSealedHeight), height)
}
func RetrieveSealedHeight(height *uint64) func(*badger.Txn) error {
return retrieve(makePrefix(codeSealedHeight), height)
}
func InsertLastCompleteBlockHeight(height uint64) func(*badger.Txn) error {
return insert(makePrefix(codeLastCompleteBlockHeight), height)
}
func UpdateLastCompleteBlockHeight(height uint64) func(*badger.Txn) error {
return update(makePrefix(codeLastCompleteBlockHeight), height)
}
func RetrieveLastCompleteBlockHeight(height *uint64) func(*badger.Txn) error {
return retrieve(makePrefix(codeLastCompleteBlockHeight), height)
}