From 95eae6dd315b97ef478b80babcd8f130bf237cde Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 9 Aug 2023 15:38:17 +0300 Subject: [PATCH] node: Drop estimations storage prm wrapper Not needed for a util with such a limited usage. Signed-off-by: Pavel Karpy --- cmd/neofs-node/container.go | 2 +- .../announcement/load/storage/storage.go | 16 ++++++---------- .../announcement/load/storage/storage_test.go | 4 ++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index 2336955db0..070bc07f27 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -150,7 +150,7 @@ func initContainerService(c *cfg) { key: pubKey, } - loadAccumulator := loadstorage.New(loadstorage.Prm{EstimationsLifeCycle: containercontract.CleanupDelta}) + loadAccumulator := loadstorage.New(containercontract.CleanupDelta) addNewEpochAsyncNotificationHandler(c, func(e event.Event) { ev := e.(netmapEv.NewEpoch) diff --git a/pkg/services/container/announcement/load/storage/storage.go b/pkg/services/container/announcement/load/storage/storage.go index fdd0a522af..f3c9760e1c 100644 --- a/pkg/services/container/announcement/load/storage/storage.go +++ b/pkg/services/container/announcement/load/storage/storage.go @@ -44,22 +44,18 @@ type Storage struct { mItems map[storageKey]*usedSpaceEstimations } -// Prm groups the required parameters of the Storage's constructor. -type Prm struct { - // EstimationsLifeCycle is a longevity (in epochs) of estimations - // that are kept in the [Storage] instance. Note, current epoch - // is controlled with [Storage.EpochEvent]. - EstimationsLifeCycle uint64 -} - // New creates a new instance of the Storage. // // The created Storage does not require additional // initialization and is completely ready for work. -func New(prm Prm) *Storage { +// +// estimationsLifeCycle is a longevity (in epochs) of estimations +// that are kept in the [Storage] instance. Note, current epoch +// is controlled with [Storage.EpochEvent]. +func New(estimationsLifeCycle uint64) *Storage { return &Storage{ mItems: make(map[storageKey]*usedSpaceEstimations), - estLifeCycle: prm.EstimationsLifeCycle, + estLifeCycle: estimationsLifeCycle, } } diff --git a/pkg/services/container/announcement/load/storage/storage_test.go b/pkg/services/container/announcement/load/storage/storage_test.go index 001b4508d5..ea85f7898e 100644 --- a/pkg/services/container/announcement/load/storage/storage_test.go +++ b/pkg/services/container/announcement/load/storage/storage_test.go @@ -18,7 +18,7 @@ func TestStorage(t *testing.T) { const opinionsNum = 100 - s := New(Prm{}) + s := New(0) opinions := make([]uint64, opinionsNum) for i := range opinions { @@ -53,7 +53,7 @@ func TestStorage_NewEpoch(t *testing.T) { const epoch uint64 = 13 const lifeCycle = 5 - s := New(Prm{EstimationsLifeCycle: lifeCycle}) + s := New(lifeCycle) var a container.SizeEstimation a.SetContainer(cidtest.ID())