github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/iavl/config/dynamic_config_okchain.go (about) 1 package config 2 3 const ( 4 DefaultCommitGapHeight = 100 5 ) 6 7 type IDynamicConfig interface { 8 GetIavlCacheSize() int 9 GetIavlFSCacheSize() int64 10 GetCommitGapHeight() int64 11 SetCommitGapHeight(gap int64) 12 } 13 14 var DynamicConfig IDynamicConfig = MockDynamicConfig{commitGapHeight: DefaultCommitGapHeight} 15 16 func SetDynamicConfig(c IDynamicConfig) { 17 DynamicConfig = c 18 } 19 20 type MockDynamicConfig struct { 21 commitGapHeight int64 22 } 23 24 func (d MockDynamicConfig) GetIavlCacheSize() int { 25 return 10000 26 } 27 28 func (d MockDynamicConfig) GetIavlFSCacheSize() int64 { 29 return 10000 30 } 31 32 func (d MockDynamicConfig) GetCommitGapHeight() int64 { 33 return d.commitGapHeight 34 } 35 36 func (d MockDynamicConfig) SetCommitGapHeight(gap int64) { 37 d.commitGapHeight = gap 38 }