action-env/cmd/frostfs-node/config/engine/shard/gc/config.go
Alex Vanin 20de74a505 Rename package name
Due to source code relocation from GitHub.

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
2023-03-07 16:38:26 +03:00

58 lines
1.3 KiB
Go

package gcconfig
import (
"time"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
)
// Config is a wrapper over the config section
// which provides access to Shard's GC configurations.
type Config config.Config
const (
// RemoverBatchSizeDefault is a default batch size for Shard GC's remover.
RemoverBatchSizeDefault = 100
// RemoverSleepIntervalDefault 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 the value of "remover_batch_size"
// config parameter.
//
// Returns RemoverBatchSizeDefault if the 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 the value of "remover_sleep_interval"
// config parameter.
//
// Returns RemoverSleepIntervalDefault if the 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
}