blobovnicza

package
v0.38.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IterateAddresses

func IterateAddresses(ctx context.Context, blz *Blobovnicza, f func(oid.Address) error) error

IterateAddresses is a helper function which iterates over Blobovnicza and passes addresses of the objects to f.

Types

type Blobovnicza

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

Blobovnicza represents the implementation of FrostFS Blobovnicza.

func New

func New(opts ...Option) *Blobovnicza

New creates and returns a new Blobovnicza instance.

func (*Blobovnicza) Close

func (b *Blobovnicza) Close() error

Close releases all internal database resources.

If blobovnicza is already closed, does nothing.

func (*Blobovnicza) Delete

func (b *Blobovnicza) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, error)

Delete removes an object from Blobovnicza by address.

Returns any error encountered that did not allow to completely delete the object.

Returns an error of type apistatus.ObjectNotFound if the object to be deleted is not in blobovnicza.

Should not be called in read-only configuration.

func (*Blobovnicza) DropMoveInfo added in v0.38.0

func (b *Blobovnicza) DropMoveInfo(ctx context.Context, address oid.Address) error

func (*Blobovnicza) Exists

func (b *Blobovnicza) Exists(ctx context.Context, addr oid.Address) (bool, error)

Exists check if object with the specified address is stored in b.

func (*Blobovnicza) Get

func (b *Blobovnicza) Get(ctx context.Context, prm GetPrm) (GetRes, error)

Get reads an object from Blobovnicza by address.

Returns any error encountered that did not allow to completely read the object.

Returns an error of type apistatus.ObjectNotFound if the requested object is not presented in Blobovnicza.

func (*Blobovnicza) Init

func (b *Blobovnicza) Init() error

Init initializes internal database structure.

If Blobovnicza is already initialized, no action is taken. Blobovnicza must be open, otherwise an error will return.

func (*Blobovnicza) IsFull added in v0.37.0

func (b *Blobovnicza) IsFull() bool

func (*Blobovnicza) Iterate

func (b *Blobovnicza) Iterate(ctx context.Context, prm IteratePrm) (IterateRes, error)

Iterate goes through all stored objects, and passes IterationElement to parameterized handler until error return.

Decodes object addresses if DecodeAddresses was called. Don't read object data if WithoutData was called.

Returns handler's errors directly. Returns nil after iterating finish.

Handler should not retain object data. Handler must not be nil.

func (*Blobovnicza) ListMoveInfo added in v0.38.0

func (b *Blobovnicza) ListMoveInfo(ctx context.Context) ([]MoveInfo, error)

func (*Blobovnicza) Open

func (b *Blobovnicza) Open() error

Open opens an internal database at the configured path with the configured permissions.

If the database file does not exist, it will be created automatically. If blobovnicza is already open, does nothing.

func (*Blobovnicza) Put

func (b *Blobovnicza) Put(ctx context.Context, prm PutPrm) (PutRes, error)

Put saves an object in Blobovnicza.

If binary representation of the object is not set, it is calculated via Marshal method.

The size of the object MUST BE less that or equal to the size specified in WithObjectSizeLimit option.

Returns any error encountered that did not allow to completely save the object.

Returns ErrFull if blobovnicza is filled.

Should not be called in read-only configuration.

func (*Blobovnicza) PutMoveInfo added in v0.38.0

func (b *Blobovnicza) PutMoveInfo(ctx context.Context, prm MoveInfo) error

type DeletePrm

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

DeletePrm groups the parameters of Delete operation.

func (*DeletePrm) SetAddress

func (p *DeletePrm) SetAddress(addr oid.Address)

SetAddress sets the address of the requested object.

type DeleteRes

type DeleteRes struct{}

DeleteRes groups the resulting values of Delete operation.

type GetPrm

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

GetPrm groups the parameters of Get operation.

func (*GetPrm) SetAddress

func (p *GetPrm) SetAddress(addr oid.Address)

SetAddress sets the address of the requested object.

type GetRes

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

GetRes groups the resulting values of Get operation.

func (GetRes) Object

func (p GetRes) Object() []byte

Object returns binary representation of the requested object.

type IteratePrm

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

IteratePrm groups the parameters of Iterate operation.

func (*IteratePrm) DecodeAddresses

func (x *IteratePrm) DecodeAddresses()

DecodeAddresses sets flag to unmarshal object addresses.

func (*IteratePrm) IgnoreErrors

func (x *IteratePrm) IgnoreErrors()

IgnoreErrors makes all errors to be ignored.

func (*IteratePrm) SetHandler

func (x *IteratePrm) SetHandler(h IterationHandler)

SetHandler sets handler to be called iteratively.

func (*IteratePrm) WithoutData

func (x *IteratePrm) WithoutData()

WithoutData sets flag to not read data of the objects.

type IterateRes

type IterateRes struct{}

IterateRes groups the resulting values of Iterate operation.

type IterationElement

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

IterationElement represents a unit of elements through which Iterate operation passes.

func (IterationElement) Address

func (x IterationElement) Address() oid.Address

Address returns address of the stored object.

func (IterationElement) ObjectData

func (x IterationElement) ObjectData() []byte

ObjectData returns stored object in a binary representation.

type IterationHandler

type IterationHandler func(IterationElement) error

IterationHandler is a generic processor of IterationElement.

type Metrics added in v0.37.0

type Metrics interface {
	IncOpenBlobovniczaCount()
	DecOpenBlobovniczaCount()

	AddOpenBlobovniczaSize(size uint64)
	SubOpenBlobovniczaSize(size uint64)

	AddOpenBlobovniczaItems(items uint64)
	SubOpenBlobovniczaItems(items uint64)
}

type MoveInfo added in v0.38.0

type MoveInfo struct {
	Address         oid.Address
	TargetStorageID []byte
}

type NoopMetrics added in v0.37.0

type NoopMetrics struct{}

func (*NoopMetrics) AddOpenBlobovniczaItems added in v0.37.0

func (m *NoopMetrics) AddOpenBlobovniczaItems(uint64)

func (*NoopMetrics) AddOpenBlobovniczaSize added in v0.37.0

func (m *NoopMetrics) AddOpenBlobovniczaSize(uint64)

func (*NoopMetrics) DecOpenBlobovniczaCount added in v0.37.0

func (m *NoopMetrics) DecOpenBlobovniczaCount()

func (*NoopMetrics) IncOpenBlobovniczaCount added in v0.37.0

func (m *NoopMetrics) IncOpenBlobovniczaCount()

func (*NoopMetrics) SubOpenBlobovniczaItems added in v0.37.0

func (m *NoopMetrics) SubOpenBlobovniczaItems(uint64)

func (*NoopMetrics) SubOpenBlobovniczaSize added in v0.37.0

func (m *NoopMetrics) SubOpenBlobovniczaSize(uint64)

type Option

type Option func(*cfg)

Option is an option of Blobovnicza's constructor.

func WithFullSizeLimit

func WithFullSizeLimit(lim uint64) Option

WithFullSizeLimit returns an option to set the maximum sum size of all stored objects.

func WithLogger

func WithLogger(l *logger.Logger) Option

WithLogger returns an option to specify Blobovnicza's logger.

func WithMetrics added in v0.37.0

func WithMetrics(m Metrics) Option

WithMetrics returns an option to set metrics storage.

func WithObjectSizeLimit

func WithObjectSizeLimit(lim uint64) Option

WithObjectSizeLimit returns an option to specify the maximum size of the objects stored in Blobovnicza.

func WithPath

func WithPath(path string) Option

WithPath returns option to set system path to Blobovnicza.

func WithPermissions

func WithPermissions(perm fs.FileMode) Option

WithPermissions returns an option to specify permission bits of Blobovnicza's system path.

func WithReadOnly

func WithReadOnly(ro bool) Option

WithReadOnly returns an option to open Blobovnicza in read-only mode.

type PutPrm

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

PutPrm groups the parameters of Put operation.

func (*PutPrm) SetAddress

func (p *PutPrm) SetAddress(addr oid.Address)

SetAddress sets the address of the saving object.

func (*PutPrm) SetMarshaledObject

func (p *PutPrm) SetMarshaledObject(data []byte)

SetMarshaledObject sets binary representation of the object.

type PutRes

type PutRes struct{}

PutRes groups the resulting values of Put operation.

Jump to

Keyboard shortcuts

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