-
Notifications
You must be signed in to change notification settings - Fork 228
/
config.go
32 lines (28 loc) · 1.4 KB
/
config.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
package config
import "github.com/crypto-org-chain/cronos/memiavl"
const DefaultCacheSize = 1000
type MemIAVLConfig struct {
// Enable defines if the memiavl should be enabled.
Enable bool `mapstructure:"enable"`
// ZeroCopy defines if the memiavl should return slices pointing to mmap-ed buffers directly (zero-copy),
// the zero-copied slices must not be retained beyond current block's execution.
// the sdk address cache will be disabled if zero-copy is enabled.
ZeroCopy bool `mapstructure:"zero-copy"`
// AsyncCommitBuffer defines the size of asynchronous commit queue, this greatly improve block catching-up
// performance, -1 means synchronous commit.
AsyncCommitBuffer int `mapstructure:"async-commit-buffer"`
// SnapshotKeepRecent defines what many old snapshots (excluding the latest one) to keep after new snapshots are
// taken, defaults to 1 to make sure ibc relayers work.
SnapshotKeepRecent uint32 `mapstructure:"snapshot-keep-recent"`
// SnapshotInterval defines the block interval the memiavl snapshot is taken, default to 1000.
SnapshotInterval uint32 `mapstructure:"snapshot-interval"`
// CacheSize defines the size of the cache for each memiavl store.
CacheSize int `mapstructure:"cache-size"`
}
func DefaultMemIAVLConfig() MemIAVLConfig {
return MemIAVLConfig{
CacheSize: DefaultCacheSize,
SnapshotInterval: memiavl.DefaultSnapshotInterval,
SnapshotKeepRecent: 1,
}
}