[#789] cmd/node: Add `refill_metabase` config to `shard` section

Implement `RefillMetabase` method to `shardconfig.Config` type which reads
`refill_metabase` config value. Pass the result to `WithRefillMetabase`
option.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/fyrchik/meta-pebble
Leonard Lyubich 2021-09-13 16:58:05 +03:00 committed by Alex Vanin
parent 6bf7a00cfe
commit b5fff810f4
2 changed files with 11 additions and 0 deletions

View File

@ -384,6 +384,7 @@ func initShardOptions(c *cfg) {
opts = append(opts, []shard.Option{
shard.WithLogger(c.log),
shard.WithRefillMetabase(sc.RefillMetabase()),
shard.WithBlobStorOptions(
blobstor.WithRootPath(blobStorCfg.Path()),
blobstor.WithCompressObjects(blobStorCfg.Compress(), c.log),

View File

@ -58,3 +58,13 @@ func (x *Config) GC() *gcconfig.Config {
Sub("gc"),
)
}
// RefillMetabase returns value of "refill_metabase" config parameter.
//
// Returns false if value is not a valid bool.
func (x *Config) RefillMetabase() bool {
return config.BoolSafe(
(*config.Config)(x),
"refill_metabase",
)
}