[#1764] neofs-node: Allow to return error from IterateShards

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-09-20 15:33:59 +03:00 committed by fyrchik
parent 898689ec14
commit 9113793688
3 changed files with 26 additions and 14 deletions

View file

@ -409,7 +409,7 @@ func initShardOptions(c *cfg) {
require := !nodeconfig.Relay(c.appCfg) // relay node does not require shards
engineconfig.IterateShards(c.appCfg, require, func(sc *shardconfig.Config) {
err := engineconfig.IterateShards(c.appCfg, require, func(sc *shardconfig.Config) error {
var writeCacheOpts []writecache.Option
writeCacheCfg := sc.WriteCache()
@ -474,7 +474,7 @@ func initShardOptions(c *cfg) {
},
})
default:
panic(fmt.Errorf("invalid storage type: %s", storages[i].Type()))
return fmt.Errorf("invalid storage type: %s", storages[i].Type())
}
}
@ -521,7 +521,11 @@ func initShardOptions(c *cfg) {
}),
shard.WithGCEventChannel(gcEventChannel),
})
return nil
})
if err != nil {
panic(err)
}
c.cfgObject.cfgLocalStorage.shardOpts = opts
}