forked from TrueCloudLab/frostfs-node
[#956] policer: Remove WithMaxCapacity option
We already provide the pool and this argument is used only for preallocation. No functional changes. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>bugfix/namespace_require
parent
053a195ac2
commit
cbfeb72466
|
@ -263,7 +263,6 @@ func addPolicer(c *cfg, keyStorage *util.KeyStorage, clientConstructor *cache.Cl
|
|||
)
|
||||
}
|
||||
}),
|
||||
policer.WithMaxCapacity(c.cfgObject.pool.replicatorPoolSize),
|
||||
policer.WithPool(c.cfgObject.pool.replication),
|
||||
policer.WithMetrics(c.metricsCollector.PolicerMetrics()),
|
||||
)
|
||||
|
|
|
@ -64,8 +64,6 @@ type cfg struct {
|
|||
|
||||
taskPool *ants.Pool
|
||||
|
||||
maxCapacity int
|
||||
|
||||
batchSize, cacheSize uint32
|
||||
|
||||
rebalanceFreq, evictDuration, sleepDuration time.Duration
|
||||
|
@ -158,14 +156,6 @@ func WithRedundantCopyCallback(cb RedundantCopyCallback) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// WithMaxCapacity returns option to set max capacity
|
||||
// that can be set to the pool.
|
||||
func WithMaxCapacity(capacity int) Option {
|
||||
return func(c *cfg) {
|
||||
c.maxCapacity = capacity
|
||||
}
|
||||
}
|
||||
|
||||
// WithPool returns option to set pool for
|
||||
// policy and replication operations.
|
||||
func WithPool(p *ants.Pool) Option {
|
||||
|
|
|
@ -66,7 +66,7 @@ func New(opts ...Option) *Policer {
|
|||
cfg: c,
|
||||
cache: cache,
|
||||
objsInWork: &objectsInWork{
|
||||
objs: make(map[oid.Address]struct{}, c.maxCapacity),
|
||||
objs: make(map[oid.Address]struct{}, c.taskPool.Cap()),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,6 +239,7 @@ func TestProcessObject(t *testing.T) {
|
|||
gotReplicateTo = append(gotReplicateTo, int(node.PublicKey()[0]))
|
||||
}
|
||||
})),
|
||||
WithPool(testPool(t)),
|
||||
)
|
||||
|
||||
addrWithType := objectcore.AddressWithType{
|
||||
|
@ -276,6 +277,7 @@ func TestProcessObjectError(t *testing.T) {
|
|||
p := New(
|
||||
WithContainerSource(source),
|
||||
WithBuryFunc(buryFn),
|
||||
WithPool(testPool(t)),
|
||||
)
|
||||
|
||||
addrWithType := objectcore.AddressWithType{
|
||||
|
@ -348,6 +350,12 @@ func TestIteratorContract(t *testing.T) {
|
|||
}, it.calls)
|
||||
}
|
||||
|
||||
func testPool(t *testing.T) *ants.Pool {
|
||||
pool, err := ants.NewPool(4)
|
||||
require.NoError(t, err)
|
||||
return pool
|
||||
}
|
||||
|
||||
type nextResult struct {
|
||||
objs []objectcore.AddressWithType
|
||||
err error
|
||||
|
|
Loading…
Reference in New Issue