Merge PR #5166: Add pruning constants and fix template
This commit is contained in:
parent
ee404e96ab
commit
8d7cc5e08d
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
@ -77,7 +78,7 @@ func DefaultConfig() *Config {
|
||||
BaseConfig{
|
||||
MinGasPrices: defaultMinGasPrices,
|
||||
InterBlockCache: true,
|
||||
Pruning: "syncable",
|
||||
Pruning: store.PruningStrategySyncable,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ inter-block-cache = {{ .BaseConfig.InterBlockCache }}
|
||||
# syncable: only those states not needed for state syncing will be deleted (keeps last 100 + every 10000th)
|
||||
# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node)
|
||||
# everything: all saved states will be deleted, storing only the current state
|
||||
pruning = {{ .BaseConfig.Pruning }}
|
||||
pruning = "{{ .BaseConfig.Pruning }}"
|
||||
`
|
||||
|
||||
var configTemplate *template.Template
|
||||
|
||||
@ -8,6 +8,13 @@ import (
|
||||
"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)
|
||||
}
|
||||
@ -18,11 +25,11 @@ func NewCommitKVStoreCacheManager() types.MultiStorePersistentCache {
|
||||
|
||||
func NewPruningOptionsFromString(strategy string) (opt PruningOptions) {
|
||||
switch strategy {
|
||||
case "nothing":
|
||||
case PruningStrategyNothing:
|
||||
opt = PruneNothing
|
||||
case "everything":
|
||||
case PruningStrategyEverything:
|
||||
opt = PruneEverything
|
||||
case "syncable":
|
||||
case PruningStrategySyncable:
|
||||
opt = PruneSyncable
|
||||
default:
|
||||
opt = PruneSyncable
|
||||
|
||||
Loading…
Reference in New Issue
Block a user