loadstorage

package
v0.22.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 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 Prm

type Prm struct{}

Prm groups the required parameters of the Storage's constructor.

The component is not parameterizable at the moment.

type Storage

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

Storage represents in-memory storage of UsedSpaceAnnouncement 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(_ Prm) *Storage

New creates a new instance of the Storage.

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

func (*Storage) Close

func (s *Storage) Close() error

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