forked from TrueCloudLab/frostfs-node
[#969] node: Do not require shard config in relay mode
Relay storage node doesn't exec local object operations, so it doesn't need shard configuration. Add `required` bool parameter to `engineconfig.IterateShards`. Make it to panic if it is `true`, and immediately return otherwise. Pass `false` if node is configured as relay in app (it also prevents panic). Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
95893927aa
commit
fb89d29574
3 changed files with 22 additions and 6 deletions
|
@ -19,13 +19,17 @@ const (
|
|||
// of "shard" subsection of "storage" section of c, wrap them into
|
||||
// shardconfig.Config and passes to f.
|
||||
//
|
||||
// Panics if N is not a positive number.
|
||||
func IterateShards(c *config.Config, f func(*shardconfig.Config)) {
|
||||
// Panics if N is not a positive number while shards are required.
|
||||
func IterateShards(c *config.Config, required bool, f func(*shardconfig.Config)) {
|
||||
c = c.Sub(subsection)
|
||||
|
||||
num := config.Uint(c, "shard_num")
|
||||
if num == 0 {
|
||||
panic("no shard configured")
|
||||
if required {
|
||||
panic("no shard configured")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
def := c.Sub("default")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue