Documentation ¶
Index ¶
- Variables
- func IterateAddresses(blz *Blobovnicza, f func(*object.Address) error) error
- func IterateObjects(blz *Blobovnicza, f func([]byte) error) error
- type Blobovnicza
- func (b *Blobovnicza) Close() error
- func (b *Blobovnicza) Delete(prm *DeletePrm) (*DeleteRes, error)
- func (b *Blobovnicza) Get(prm *GetPrm) (*GetRes, error)
- func (b *Blobovnicza) GetRange(prm *GetRangePrm) (*GetRangeRes, error)
- func (b *Blobovnicza) Init() error
- func (b *Blobovnicza) Iterate(prm IteratePrm) (*IterateRes, error)
- func (b *Blobovnicza) Open() error
- func (b *Blobovnicza) Put(prm *PutPrm) (*PutRes, error)
- type DeletePrm
- type DeleteRes
- type GetPrm
- type GetRangePrm
- type GetRangeRes
- type GetRes
- type ID
- type IteratePrm
- type IterateRes
- type IterationElement
- type IterationHandler
- type Option
- type PutPrm
- type PutRes
Constants ¶
This section is empty.
Variables ¶
var ErrFull = errors.New("blobovnicza is full")
ErrFull is returned returned when trying to save an object to a filled blobovnicza.
Functions ¶
func IterateAddresses ¶ added in v0.26.0
func IterateAddresses(blz *Blobovnicza, f func(*object.Address) error) error
IterateAddresses is a helper function which iterates over Blobovnicza and passes addresses of the objects to f.
func IterateObjects ¶ added in v0.25.0
func IterateObjects(blz *Blobovnicza, f func([]byte) error) error
IterateObjects is a helper function which iterates over Blobovnicza and passes binary objects to f.
Types ¶
type Blobovnicza ¶
type Blobovnicza struct {
// contains filtered or unexported fields
}
Blobovnicza represents the implementation of NeoFS Blobovnicza.
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.
Should not be called in read-only configuration.
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)
GetRange reads range of 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.
Should not be called in read-only configuration.
func (*Blobovnicza) Iterate ¶ added in v0.25.0
func (b *Blobovnicza) Iterate(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) 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.
Should not be called in read-only configuration.
type DeletePrm ¶
type DeletePrm struct {
// contains filtered or unexported fields
}
DeletePrm groups the parameters of Delete operation.
func (*DeletePrm) SetAddress ¶
SetAddress sets address of the requested object.
type GetPrm ¶
type GetPrm struct {
// contains filtered or unexported fields
}
GetPrm groups the parameters of Get operation.
func (*GetPrm) SetAddress ¶
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)
SetRange 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.
type ID ¶
type ID []byte
ID represents Blobovnicza identifier.
func NewIDFromBytes ¶
NewIDFromBytes constructs ID from byte slice.
type IteratePrm ¶ added in v0.25.0
type IteratePrm struct {
// contains filtered or unexported fields
}
IteratePrm groups the parameters of Iterate operation.
func (*IteratePrm) DecodeAddresses ¶ added in v0.26.0
func (x *IteratePrm) DecodeAddresses()
DecodeAddresses sets flag to unmarshal object addresses.
func (*IteratePrm) SetHandler ¶ added in v0.25.0
func (x *IteratePrm) SetHandler(h IterationHandler)
SetHandler sets handler to be called iteratively.
func (*IteratePrm) WithoutData ¶ added in v0.26.0
func (x *IteratePrm) WithoutData()
WithoutData sets flag to not read data of the objects.
type IterateRes ¶ added in v0.25.0
type IterateRes struct { }
IterateRes groups resulting values of Iterate operation.
type IterationElement ¶ added in v0.25.0
type IterationElement struct {
// contains filtered or unexported fields
}
IterationElement represents a unit of elements through which Iterate operation passes.
func (IterationElement) Address ¶ added in v0.26.0
func (x IterationElement) Address() *object.Address
Address returns address of the stored object.
func (IterationElement) ObjectData ¶ added in v0.25.0
func (x IterationElement) ObjectData() []byte
ObjectData returns stored object in a binary representation.
type IterationHandler ¶ added in v0.25.0
type IterationHandler func(IterationElement) error
IterationHandler is a generic processor of IterationElement.
type Option ¶
type Option func(*cfg)
Option is an option of Blobovnicza's constructor.
func ReadOnly ¶ added in v0.26.0
func ReadOnly() Option
ReadOnly returns option to open Blobovnicza in read-only mode.
func WithFullSizeLimit ¶
WithFullSizeLimit returns option to set maximum sum size of all stored objects.
func WithLogger ¶
WithLogger returns option to specify Blobovnicza's logger.
func WithObjectSizeLimit ¶
WithObjectSizeLimit returns option to specify maximum size of the objects stored in Blobovnicza.
func WithPermissions ¶
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 ¶
SetAddress sets address of saving object.
func (*PutPrm) SetMarshaledObject ¶
SetMarshaledObject sets binary representation of the object.