-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
Copy pathstore.go
49 lines (39 loc) · 1.18 KB
/
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
44
45
46
47
48
49
package transient
import (
dbm "github.com/tendermint/tm-db"
pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types"
"github.com/cosmos/cosmos-sdk/store/dbadapter"
"github.com/cosmos/cosmos-sdk/store/types"
)
var (
_ types.Committer = (*Store)(nil)
_ 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{Store: dbadapter.Store{DB: dbm.NewMemDB()}}
}
// Implements CommitStore
// Commit cleans up Store.
func (ts *Store) Commit() (id types.CommitID) {
ts.Store = dbadapter.Store{DB: dbm.NewMemDB()}
return
}
func (ts *Store) SetPruning(_ pruningtypes.PruningOptions) {}
// GetPruning is a no-op as pruning options cannot be directly set on this store.
// They must be set on the root commit multi-store.
func (ts *Store) GetPruning() pruningtypes.PruningOptions {
return pruningtypes.NewPruningOptions(pruningtypes.PruningUndefined)
}
// Implements CommitStore
func (ts *Store) LastCommitID() (id types.CommitID) {
return
}
// Implements Store.
func (ts *Store) GetStoreType() types.StoreType {
return types.StoreTypeTransient
}