[#1607] services/tree: allow to customize some parameters

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-07-19 11:03:13 +03:00 committed by fyrchik
parent 2334e94fdb
commit b549cc314c
6 changed files with 49 additions and 8 deletions

View file

@ -17,6 +17,10 @@ type cfg struct {
nmSource netmap.Source
cnrSource container.Source
forest pilorama.Forest
// replication-related parameters
replicatorChannelCapacity int
replicatorWorkerCount int
containerCacheSize int
}
// Option represents configuration option for a tree service.
@ -60,3 +64,27 @@ func WithStorage(s pilorama.Forest) Option {
c.forest = s
}
}
func WithReplicationChannelCapacity(n int) Option {
return func(c *cfg) {
if n > 0 {
c.replicatorChannelCapacity = n
}
}
}
func WithReplicationWorkerCount(n int) Option {
return func(c *cfg) {
if n > 0 {
c.replicatorWorkerCount = n
}
}
}
func WithContainerCacheSize(n int) Option {
return func(c *cfg) {
if n > 0 {
c.containerCacheSize = n
}
}
}