common

package
v0.41.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSpace = logicerr.New("no free space")

ErrNoSpace MUST be returned when there is no space to put an object on the device.

View Source
var ErrReadOnly = logicerr.New("opened as read-only")

ErrReadOnly MUST be returned for modifying operations when the storage was opened in readonly mode.

Functions

func Copy added in v0.38.0

func Copy(dst, src Storage) error

Copy copies all objects from source Storage into the destination one. If any object cannot be stored, Copy immediately fails.

Types

type DeletePrm

type DeletePrm struct {
	Address   oid.Address
	StorageID []byte
}

DeletePrm groups the parameters of Delete operation.

type DeleteRes

type DeleteRes struct{}

DeleteRes groups the resulting values of Delete operation.

type ExistsPrm

type ExistsPrm struct {
	Address   oid.Address
	StorageID []byte
}

ExistsPrm groups the parameters of Exists operation.

type ExistsRes

type ExistsRes struct {
	Exists bool
}

ExistsRes groups the resulting values of Exists operation.

type GetPrm

type GetPrm struct {
	Address   oid.Address
	StorageID []byte
	Raw       bool
}

type GetRangePrm

type GetRangePrm struct {
	Address   oid.Address
	Range     objectSDK.Range
	StorageID []byte
}

type GetRangeRes

type GetRangeRes struct {
	Data []byte
}

type GetRes

type GetRes struct {
	Object  *objectSDK.Object
	RawData []byte
}

type IteratePrm

type IteratePrm struct {
	Handler      IterationHandler
	LazyHandler  func(oid.Address, func() ([]byte, error)) error
	IgnoreErrors bool
	ErrorHandler func(oid.Address, error) error
}

IteratePrm groups the parameters of Iterate operation.

type IterateRes

type IterateRes struct{}

IterateRes groups the resulting values of Iterate operation.

type IterationElement

type IterationElement struct {
	ObjectData []byte
	Address    oid.Address
	StorageID  []byte
}

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

type IterationHandler

type IterationHandler func(IterationElement) error

IterationHandler is a generic processor of IterationElement.

type PutPrm

type PutPrm struct {
	Address      oid.Address
	Object       *objectSDK.Object
	RawData      []byte
	DontCompress bool
}

PutPrm groups the parameters of Put operation.

type PutRes

type PutRes struct {
	StorageID []byte
}

PutRes groups the resulting values of Put operation.

type Storage

type Storage interface {
	Open(readOnly bool) error
	Init() error
	Close() error

	Type() string
	Path() string
	SetCompressor(cc *compression.Config)
	// SetReportErrorFunc allows to provide a function to be called on disk errors.
	// This function MUST be called before Open.
	SetReportErrorFunc(f func(string, error))

	// GetBytes reads object by address into memory buffer in a canonical NeoFS
	// binary format. Returns [apistatus.ObjectNotFound] if object is missing.
	GetBytes(oid.Address) ([]byte, error)
	Get(GetPrm) (GetRes, error)
	GetRange(GetRangePrm) (GetRangeRes, error)
	Exists(ExistsPrm) (ExistsRes, error)
	Put(PutPrm) (PutRes, error)
	Delete(DeletePrm) (DeleteRes, error)
	Iterate(IteratePrm) (IterateRes, error)
}

Storage represents key-value object storage. It is used as a building block for a blobstor of a shard.

Jump to

Keyboard shortcuts

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