[#1524] writecache: Add some bolt parameters to the configuration

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-06-16 18:21:10 +03:00 committed by LeL
parent 07e06249d5
commit 972ca83e23
4 changed files with 32 additions and 0 deletions

View file

@ -1,6 +1,8 @@
package writecache
import (
"time"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
"go.uber.org/zap"
@ -31,6 +33,10 @@ type options struct {
maxCacheSize uint64
// objCounters is an ObjectCounters instance needed for cache size estimation.
objCounters ObjectCounters
// maxBatchSize is the maximum batch size for the small object database.
maxBatchSize int
// maxBatchDelay is the maximum batch wait time for the small object database.
maxBatchDelay time.Duration
}
// WithLogger sets logger.
@ -107,3 +113,21 @@ func WithMaxCacheSize(sz uint64) Option {
o.maxCacheSize = sz
}
}
// WithMaxBatchSize sets max batch size for the small object database.
func WithMaxBatchSize(sz int) Option {
return func(o *options) {
if sz > 0 {
o.maxBatchSize = sz
}
}
}
// WithMaxBatchDelay sets max batch delay for the small object database.
func WithMaxBatchDelay(d time.Duration) Option {
return func(o *options) {
if d > 0 {
o.maxBatchDelay = d
}
}
}