Documentation
¶
Index ¶
Constants ¶
const IDSize = 16
IDSize is the binary shard ID size in bytes.
Variables ¶
var ErrNoSpace = logicerr.New("no free space")
ErrNoSpace MUST be returned when there is no space to put an object on the device.
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
Copy copies all objects from source Storage into the destination one. If any object cannot be stored, Copy immediately fails.
func CopyBatched ¶ added in v0.46.0
CopyBatched copies all objects from source Storage into the destination one using batched API. If any batch cannot be stored, Copy immediately fails. batchSize less than or equal to 1 makes it the same as Copy.
Types ¶
type ID ¶ added in v0.53.0
type ID struct {
// contains filtered or unexported fields
}
ID represents a shard identifier. Implements the built-in comparable interface.
func DecodeIDString ¶ added in v0.53.0
DecodeIDString decodes base58 string into ID.
func NewIDFromBytes ¶ added in v0.53.0
NewIDFromBytes constructs ID from fixed-size raw bytes.
type Storage ¶
type Storage interface {
Open(readOnly bool) error
Init(ID) error
Close() error
Type() string
Path() string
ShardID() ID
SetCompressor(cc *compression.Config)
// 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(oid.Address) (*object.Object, error)
GetRangeStream(addr oid.Address, off uint64, ln uint64) (uint64, io.ReadCloser, error)
GetStream(oid.Address) (*object.Object, io.ReadCloser, error)
Head(oid.Address) (*object.Object, error)
ReadHeader(oid.Address, []byte) (int, error)
ReadObject(oid.Address, []byte) (int, io.ReadCloser, error)
ReadPayloadRange(oid.Address, uint64, uint64, []byte) (io.ReadCloser, error)
Exists(oid.Address) (bool, error)
Put(oid.Address, []byte) error
PutBatch(map[oid.Address][]byte) error
Delete(oid.Address) error
Iterate(func(oid.Address, []byte) error, func(oid.Address, error) error) error
IterateAddresses(func(oid.Address) error, bool) error
}
Storage represents key-value object storage. It is used as a building block for a blobstor of a shard.