Documentation ¶
Index ¶
- Constants
- type Peapod
- func (x *Peapod) Close() error
- func (x *Peapod) Delete(prm common.DeletePrm) (common.DeleteRes, error)
- func (x *Peapod) Exists(prm common.ExistsPrm) (common.ExistsRes, error)
- func (x *Peapod) Get(prm common.GetPrm) (common.GetRes, error)
- func (x *Peapod) GetRange(prm common.GetRangePrm) (common.GetRangeRes, error)
- func (x *Peapod) Init() error
- func (x *Peapod) Iterate(prm common.IteratePrm) (common.IterateRes, error)
- func (x *Peapod) IterateAddresses(f func(addr oid.Address) error) error
- func (x *Peapod) Open(readOnly bool) error
- func (x *Peapod) Path() string
- func (x *Peapod) Put(prm common.PutPrm) (common.PutRes, error)
- func (x *Peapod) SetCompressor(cc *compression.Config)
- func (x *Peapod) SetReportErrorFunc(func(string, error))
- 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 ¶
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.
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) GetRange ¶
func (x *Peapod) GetRange(prm common.GetRangePrm) (common.GetRangeRes, error)
GetRange works like Get but reads specific payload range.
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(prm common.IteratePrm) (common.IterateRes, error)
Iterate iterates over all objects stored in the underlying database and passes them into LazyHandler or Handler. Break on f's false return.
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.
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)