Documentation ¶
Index ¶
- Constants
- type Peapoddeprecated
- func (x *Peapod) Close() error
- func (x *Peapod) Delete(addr oid.Address) error
- func (x *Peapod) Exists(addr oid.Address) (bool, error)
- func (x *Peapod) Get(addr oid.Address) (*objectSDK.Object, error)
- func (x *Peapod) GetBytes(addr oid.Address) ([]byte, error)
- func (x *Peapod) GetRange(addr oid.Address, from uint64, length uint64) ([]byte, error)
- func (x *Peapod) Init() error
- func (x *Peapod) Iterate(objHandler func(addr oid.Address, data []byte, id []byte) error, ...) error
- func (x *Peapod) IterateAddresses(f func(addr oid.Address) error, ignoreErrors bool) error
- func (x *Peapod) Open(readOnly bool) error
- func (x *Peapod) Path() string
- func (x *Peapod) Put(addr oid.Address, data []byte) error
- func (x *Peapod) SetCompressor(cc *compression.Config)
- func (x *Peapod) SetLogger(l *zap.Logger)
- func (x *Peapod) Type() string
Constants ¶
const Type = "peapod"
Type is peapod storage type used in logs and configuration.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Peapod
deprecated
type Peapod struct {
// contains filtered or unexported fields
}
Peapod provides storage for relatively small NeoFS binary object (peas). Peapod is a single low-level key/value database optimized to work with big number of stored units.
Deprecated: Use fstree.FSTree instead.
func New ¶
New creates new Peapod instance to be located at the given path with specified permissions.
Specified flush interval MUST be positive (see Init).
Note that resulting Peapod is NOT ready-to-go:
- configure compression first (SetCompressor method)
- then open the instance (Open method). Opened Peapod must be finally closed
- initialize internal database structure (Init method). May be skipped for read-only usage
Any other usage is unsafe and may lead to panic.
func (*Peapod) Delete ¶
Delete removes data associated with the given object address from the underlying database. Delete returns apistatus.ErrObjectNotFound if object is missing.
Put returns common.ErrReadOnly if Peadpod is read-only.
func (*Peapod) Exists ¶
Exists checks presence of the object in the underlying database by the given address.
func (*Peapod) Get ¶
Get reads data from the underlying database by the given object address. Returns apistatus.ErrObjectNotFound if object is missing in the Peapod.
func (*Peapod) GetBytes ¶ added in v0.41.0
GetBytes reads object from the Peapod by address into memory buffer in a canonical NeoFS binary format. Returns apistatus.ObjectNotFound if object is missing.
func (*Peapod) Init ¶
Init initializes internal structure of the underlying database and runs flushing routine. The routine writes data batches into disk once per time interval configured in New.
func (*Peapod) Iterate ¶
func (x *Peapod) Iterate(objHandler func(addr oid.Address, data []byte, id []byte) error, errorHandler func(addr oid.Address, err error) error) error
Iterate iterates over all objects stored in the underlying database and passes them into objHandler. Errors are passed into errorHandler if it's specified. If error is returned from handlers iteration stops.
Use IterateAddresses to iterate over keys only.
func (*Peapod) IterateAddresses ¶
IterateAddresses iterates over all objects stored in the underlying database and passes their addresses into f. If f returns an error, IterateAddresses returns it and breaks. ignoreErrors allows to continue if internal errors happen.
func (*Peapod) Put ¶
Put saves given data in the underlying database by specified object address. The data can be anything, but in practice a binary NeoFS object is expected. Operation is executed within provided context: if the context is done, Put returns its error (in this case data may be saved).
Put returns common.ErrReadOnly if Peadpod is read-only.
func (*Peapod) SetCompressor ¶
func (x *Peapod) SetCompressor(cc *compression.Config)