-
Notifications
You must be signed in to change notification settings - Fork 177
/
views.go
37 lines (29 loc) · 1.28 KB
/
views.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
package operation
import (
"github.com/dgraph-io/badger/v2"
"github.com/onflow/flow-go/model/flow"
)
// InsertStartedView inserts a view into the database.
func InsertStartedView(chainID flow.ChainID, view uint64) func(*badger.Txn) error {
return insert(makePrefix(codeStartedView, chainID), view)
}
// UpdateStartedView updates the view in the database.
func UpdateStartedView(chainID flow.ChainID, view uint64) func(*badger.Txn) error {
return update(makePrefix(codeStartedView, chainID), view)
}
// RetrieveStartedView retrieves a view from the database.
func RetrieveStartedView(chainID flow.ChainID, view *uint64) func(*badger.Txn) error {
return retrieve(makePrefix(codeStartedView, chainID), view)
}
// InsertVotedView inserts a view into the database.
func InsertVotedView(chainID flow.ChainID, view uint64) func(*badger.Txn) error {
return insert(makePrefix(codeVotedView, chainID), view)
}
// UpdateVotedView updates the view in the database.
func UpdateVotedView(chainID flow.ChainID, view uint64) func(*badger.Txn) error {
return update(makePrefix(codeVotedView, chainID), view)
}
// RetrieveVotedView retrieves a view from the database.
func RetrieveVotedView(chainID flow.ChainID, view *uint64) func(*badger.Txn) error {
return retrieve(makePrefix(codeVotedView, chainID), view)
}