blobovnicza

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFull = errors.New("blobovnicza is full")

ErrFull is returned returned when trying to save an object to a filled blobovnicza.

Functions

This section is empty.

Types

type Blobovnicza

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

Blobovnicza represents the implementation of NeoFS Blobovnicza.

func New

func New(opts ...Option) *Blobovnicza

New creates and returns new Blobovnicza instance.

func (*Blobovnicza) Close

func (b *Blobovnicza) Close() error

Close releases all internal database resources.

func (*Blobovnicza) Delete

func (b *Blobovnicza) Delete(prm *DeletePrm) (*DeleteRes, error)

Delete removes object from Blobovnicza by address.

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

Returns ErrNotFound if the object to be deleted is not in blobovnicza.

func (*Blobovnicza) Get

func (b *Blobovnicza) Get(prm *GetPrm) (*GetRes, error)

Get reads the object from Blobovnicza by address.

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

Returns ErrNotFound if requested object is not presented in Blobovnicza.

func (*Blobovnicza) GetRange

func (b *Blobovnicza) GetRange(prm *GetRangePrm) (*GetRangeRes, error)

Get reads the object from Blobovnicza by address.

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

Returns ErrNotFound if requested object is not presented in Blobovnicza. Returns ErrRangeOutOfBounds if requested range is outside the payload.

func (*Blobovnicza) Init

func (b *Blobovnicza) Init() error

Init initializes internal database structure.

If Blobovnicza is already initialized, then no action is taken.

func (*Blobovnicza) Open

func (b *Blobovnicza) Open() error

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

If the database file does not exist then it will be created automatically.

func (*Blobovnicza) Put

func (b *Blobovnicza) Put(prm *PutPrm) (*PutRes, error)

Put saves 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.

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 *objectSDK.Address)

SetAddress sets address of the requested object.

type DeleteRes

type DeleteRes struct {
}

DeleteRes groups 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 *objectSDK.Address)

SetAddress sets address of the requested object.

type GetRangePrm

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

GetRangePrm groups the parameters of GetRange operation.

func (*GetRangePrm) SetAddress

func (p *GetRangePrm) SetAddress(addr *objectSDK.Address)

SetAddress sets address of the requested object.

func (*GetRangePrm) SetRange

func (p *GetRangePrm) SetRange(rng *objectSDK.Range)

SetAddress sets range of the requested payload data .

type GetRangeRes

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

GetRangeRes groups resulting values of GetRange operation.

func (*GetRangeRes) RangeData

func (p *GetRangeRes) RangeData() []byte

RangeData returns the requested payload data range.

type GetRes

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

GetRes groups resulting values of Get operation.

func (*GetRes) Object

func (p *GetRes) Object() []byte

Object returns binary representation of the requested object.

type ID

type ID []byte

ID represents Blobovnicza identifier.

func NewIDFromBytes

func NewIDFromBytes(v []byte) *ID

NewIDFromBytes constructs ID from byte slice.

func (ID) String

func (id ID) String() string

type Option

type Option func(*cfg)

Option is an option of Blobovnicza's constructor.

func WithFullSizeLimit

func WithFullSizeLimit(lim uint64) Option

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

func WithLogger

func WithLogger(l *logger.Logger) Option

WithLogger returns option to specify Blobovnicza's logger.

func WithObjectSizeLimit

func WithObjectSizeLimit(lim uint64) Option

WithSizeLimit returns option to specify 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 os.FileMode) Option

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

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 *objectSDK.Address)

SetAddress sets address of 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 resulting values of Put operation.

Jump to

Keyboard shortcuts

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