-
Notifications
You must be signed in to change notification settings - Fork 2
/
store.go
43 lines (33 loc) · 882 Bytes
/
store.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
package transient
import (
dbm "github.com/tendermint/tm-db"
"github.com/hdac-io/friday/store/types"
"github.com/hdac-io/friday/store/dbadapter"
)
var _ types.Committer = (*Store)(nil)
var _ types.KVStore = (*Store)(nil)
// Store is a wrapper for a MemDB with Commiter implementation
type Store struct {
dbadapter.Store
}
// Constructs new MemDB adapter
func NewStore() *Store {
return &Store{dbadapter.Store{dbm.NewMemDB()}}
}
// Implements CommitStore
// Commit cleans up Store.
func (ts *Store) Commit() (id types.CommitID) {
ts.Store = dbadapter.Store{dbm.NewMemDB()}
return
}
// Implements CommitStore
func (ts *Store) SetPruning(pruning types.PruningOptions) {
}
// Implements CommitStore
func (ts *Store) LastCommitID() (id types.CommitID) {
return
}
// Implements Store.
func (ts *Store) GetStoreType() types.StoreType {
return types.StoreTypeTransient
}