loadstorage

package
v0.38.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage represents in-memory storage of container.SizeEstimation values.

The write operation has the usual behavior - to save the next number of used container space for a specific epoch. All values related to one key (epoch, container ID) are stored as a list.

Storage also provides an iterator interface, into the handler of which the final score is passed, built on all values saved at the time of the call. Currently the only possible estimation formula is used - the average between 10th and 90th percentile.

For correct operation, Storage must be created using the constructor (New) based on the required parameters and optional components. After successful creation, Storage is immediately ready to work through API.

func New

func New(estimationsLifeCycle uint64) *Storage

New creates a new instance of the Storage.

The created Storage does not require additional initialization and is completely ready for work.

estimationsLifeCycle is a longevity (in epochs) of estimations that are kept in the Storage instance. Note, current epoch is controlled with Storage.EpochEvent.

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) EpochEvent added in v0.38.0

func (s *Storage) EpochEvent(e uint64)

EpochEvent notifies Storage about epoch counter updating. Used to remove unused estimations. See [Prm.EstimationsLifeCycle]. Blocking operation.

func (*Storage) Iterate

Iterate goes through all the lists with the key (container ID, epoch), calculates the final grade for all values, and passes it to the handler.

Final grade is the average between 10th and 90th percentiles.

func (*Storage) Put

Put appends the next value of the occupied container space for the epoch to the list of already saved values.

Always returns nil error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL