forked from nspcc-dev/neofs-node
-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.go
58 lines (46 loc) · 1.27 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package gcconfig
import (
"time"
"github.com/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
}