forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
store.go
38 lines (32 loc) · 952 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
package store
import (
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/store/cache"
"github.com/cosmos/cosmos-sdk/store/rootmulti"
"github.com/cosmos/cosmos-sdk/store/types"
)
// Pruning strategies that may be provided to a KVStore to enable pruning.
const (
PruningStrategyNothing = "nothing"
PruningStrategyEverything = "everything"
PruningStrategySyncable = "syncable"
)
func NewCommitMultiStore(db dbm.DB) types.CommitMultiStore {
return rootmulti.NewStore(db)
}
func NewCommitKVStoreCacheManager() types.MultiStorePersistentCache {
return cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize)
}
func NewPruningOptionsFromString(strategy string) (opt PruningOptions) {
switch strategy {
case PruningStrategyNothing:
opt = PruneNothing
case PruningStrategyEverything:
opt = PruneEverything
case PruningStrategySyncable:
opt = PruneSyncable
default:
opt = PruneSyncable
}
return
}