blobovniczatree

package
v0.38.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const Type = "blobovnicza"

Type is blobovniczatree storage type used in logs and configuration.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blobovniczas

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

Blobovniczas represents the storage of the "small" objects.

Each object is stored in Blobovnicza's (B-s). B-s are structured in a multilevel directory hierarchy with fixed depth and width (configured by BlobStor).

Example (width = 4, depth = 3):

x===============================x |[0] [1] [2] [3]| | \ / | | \ / | | \ / | | \ / | |[0] [1] [2] [3]| | | / | | | / | | | / | | | / | |[0](F) [1](A) [X] [X]| x===============================x

Elements of the deepest level are B-s. B-s are allocated dynamically. At each moment of the time there is an active B (ex. A), set of already filled B-s (ex. F) and a list of not yet initialized B-s (ex. X). After filling the active B it becomes full, and next B becomes initialized and active.

Active B and some of the full B-s are cached (LRU). All cached B-s are intitialized and opened.

Object is saved as follows:

  1. at each level, according to HRW, the next one is selected and dives into it until we reach the deepest;
  2. at the B-s level object is saved to the active B. If active B is full, next B is opened, initialized and cached. If there is no more X candidates, goto 1 and process next level.

After the object is saved in B, path concatenation is returned in system path format as B identifier (ex. "0/1/1" or "3/2/1").

func NewBlobovniczaTree

func NewBlobovniczaTree(opts ...Option) (blz *Blobovniczas)

NewBlobovniczaTree returns new instance of blobovnizas tree.

func (*Blobovniczas) Close

func (b *Blobovniczas) Close() error

Close implements common.Storage.

func (*Blobovniczas) Delete

func (b *Blobovniczas) Delete(prm common.DeletePrm) (res common.DeleteRes, err error)

Delete deletes object from blobovnicza tree.

If blobocvnicza ID is specified, only this blobovnicza is processed. Otherwise, all Blobovniczas are processed descending weight.

func (*Blobovniczas) Exists

func (b *Blobovniczas) Exists(prm common.ExistsPrm) (common.ExistsRes, error)

Exists implements common.Storage.

func (*Blobovniczas) Get

func (b *Blobovniczas) Get(prm common.GetPrm) (res common.GetRes, err error)

Get reads object from blobovnicza tree.

If blobocvnicza ID is specified, only this blobovnicza is processed. Otherwise, all Blobovniczas are processed descending weight.

func (*Blobovniczas) GetRange

func (b *Blobovniczas) GetRange(prm common.GetRangePrm) (res common.GetRangeRes, err error)

GetRange reads range of object payload data from blobovnicza tree.

If blobocvnicza ID is specified, only this blobovnicza is processed. Otherwise, all Blobovniczas are processed descending weight.

func (*Blobovniczas) Init

func (b *Blobovniczas) Init() error

Init initializes blobovnicza tree.

Should be called exactly once.

func (*Blobovniczas) Iterate

func (b *Blobovniczas) Iterate(prm common.IteratePrm) (common.IterateRes, error)

Iterate iterates over all objects in b.

func (*Blobovniczas) Open

func (b *Blobovniczas) Open(readOnly bool) error

Open opens blobovnicza tree.

func (*Blobovniczas) Path added in v0.33.0

func (b *Blobovniczas) Path() string

Path implements common.Storage.

func (*Blobovniczas) Put

func (b *Blobovniczas) Put(prm common.PutPrm) (common.PutRes, error)

Put saves object in the maximum weight blobobnicza.

returns error if could not save object in any blobovnicza.

func (*Blobovniczas) SetCompressor

func (b *Blobovniczas) SetCompressor(cc *compression.Config)

SetCompressor implements common.Storage.

func (*Blobovniczas) SetReportErrorFunc added in v0.36.0

func (b *Blobovniczas) SetReportErrorFunc(f func(string, error))

SetReportErrorFunc implements common.Storage.

func (*Blobovniczas) Type

func (b *Blobovniczas) Type() string

Type implements common.Storage.

type Option

type Option func(*cfg)

func WithBlobovniczaShallowDepth

func WithBlobovniczaShallowDepth(depth uint64) Option

func WithBlobovniczaShallowWidth

func WithBlobovniczaShallowWidth(width uint64) Option

func WithBlobovniczaSize

func WithBlobovniczaSize(sz uint64) Option

func WithLogger

func WithLogger(l *zap.Logger) Option

func WithObjectSizeLimit

func WithObjectSizeLimit(sz uint64) Option

func WithOpenedCacheSize

func WithOpenedCacheSize(sz int) Option

func WithPermissions

func WithPermissions(perm fs.FileMode) Option

func WithRootPath

func WithRootPath(p string) Option

Jump to

Keyboard shortcuts

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