[#1607] services/tree: allow to customize some parameters
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
2334e94fdb
commit
b549cc314c
6 changed files with 49 additions and 8 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue