forked from TrueCloudLab/frostfs-node
[#493] node/config: Implement sections of local object storage
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
e26dc0a6e3
commit
f663a1c125
7 changed files with 530 additions and 0 deletions
59
cmd/neofs-node/config/engine/shard/gc/config.go
Normal file
59
cmd/neofs-node/config/engine/shard/gc/config.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package gcconfig
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
||||
)
|
||||
|
||||
// Config is a wrapper over the config section
|
||||
// which provides access to Shard's GC configurations.
|
||||
type Config config.Config
|
||||
|
||||
// config defaults
|
||||
const (
|
||||
// RemoverBatchSizeDefault is a default batch size for Shard GC's remover.
|
||||
RemoverBatchSizeDefault = 100
|
||||
|
||||
// RemoverSleepInterval is a default sleep interval of Shard GC's remover.
|
||||
RemoverSleepIntervalDefault = time.Minute
|
||||
)
|
||||
|
||||
// From wraps config section into Config.
|
||||
func From(c *config.Config) *Config {
|
||||
return (*Config)(c)
|
||||
}
|
||||
|
||||
// RemoverBatchSize returns value of "remover_batch_size"
|
||||
// config parameter.
|
||||
//
|
||||
// Returns RemoverBatchSizeDefault if value is not a positive number.
|
||||
func (x *Config) RemoverBatchSize() int {
|
||||
s := config.IntSafe(
|
||||
(*config.Config)(x),
|
||||
"remover_batch_size",
|
||||
)
|
||||
|
||||
if s > 0 {
|
||||
return int(s)
|
||||
}
|
||||
|
||||
return RemoverBatchSizeDefault
|
||||
}
|
||||
|
||||
// RemoverSleepInterval returns value of "remover_sleep_interval"
|
||||
// config parameter.
|
||||
//
|
||||
// Returns RemoverSleepIntervalDefault if value is not a positive number.
|
||||
func (x *Config) RemoverSleepInterval() time.Duration {
|
||||
s := config.DurationSafe(
|
||||
(*config.Config)(x),
|
||||
"remover_sleep_interval",
|
||||
)
|
||||
|
||||
if s > 0 {
|
||||
return s
|
||||
}
|
||||
|
||||
return RemoverSleepIntervalDefault
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue