Skip to content

Commit

Permalink
node: Drop estimations storage prm wrapper
Browse files Browse the repository at this point in the history
Not needed for a util with such a limited usage.

Signed-off-by: Pavel Karpy <[email protected]>
  • Loading branch information
carpawell committed Aug 9, 2023
1 parent 2cea401 commit 20a00ef
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/neofs-node/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 6 additions & 10 deletions pkg/services/container/announcement/load/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 20a00ef

Please sign in to comment.