[#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>
This commit is contained in:
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{ opts = append(opts, []shard.Option{
shard.WithLogger(c.log), shard.WithLogger(c.log),
shard.WithRefillMetabase(sc.RefillMetabase()),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithRootPath(blobStorCfg.Path()), blobstor.WithRootPath(blobStorCfg.Path()),
blobstor.WithCompressObjects(blobStorCfg.Compress(), c.log), blobstor.WithCompressObjects(blobStorCfg.Compress(), c.log),

View file

@ -58,3 +58,13 @@ func (x *Config) GC() *gcconfig.Config {
Sub("gc"), 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",
)
}