Documentation ¶
Index ¶
- Variables
- func Delete(db *DB, addrs ...*objectSDK.Address) error
- func DoNotMove(db *DB, addr *objectSDK.Address) error
- func Exists(db *DB, addr *objectSDK.Address) (bool, error)
- func Get(db *DB, addr *objectSDK.Address) (*object.Object, error)
- func GetRaw(db *DB, addr *objectSDK.Address, raw bool) (*object.Object, error)
- func Inhume(db *DB, target, tomb *objectSDK.Address) error
- func IsSmall(db *DB, addr *objectSDK.Address) (*blobovnicza.ID, error)
- func Movable(db *DB) ([]*objectSDK.Address, error)
- func Put(db *DB, obj *object.Object, id *blobovnicza.ID) error
- func Select(db *DB, cid *cid.ID, fs object.SearchFilters) ([]*object.Address, error)
- func ToMoveIt(db *DB, addr *objectSDK.Address) error
- type CleanUpPrm
- type CleanUpRes
- type Cursor
- type DB
- func (db *DB) CleanUp(prm *CleanUpPrm) (res *CleanUpRes, err error)
- func (db *DB) Close() error
- func (db *DB) ContainerSize(id *cid.ID) (size uint64, err error)
- func (db *DB) Containers() (list []*cid.ID, err error)
- func (db *DB) Delete(prm *DeletePrm) (*DeleteRes, error)
- func (db *DB) DoNotMove(prm *DoNotMovePrm) (res *DoNotMoveRes, err error)
- func (db *DB) DumpInfo() Info
- func (db *DB) Exists(prm *ExistsPrm) (res *ExistsRes, err error)
- func (db *DB) Get(prm *GetPrm) (res *GetRes, err error)
- func (db *DB) Inhume(prm *InhumePrm) (res *InhumeRes, err error)
- func (db *DB) Init() error
- func (db *DB) IsSmall(prm *IsSmallPrm) (res *IsSmallRes, err error)
- func (db *DB) IterateCoveredByTombstones(tss map[string]struct{}, h func(*object.Address) error) error
- func (db *DB) IterateExpired(epoch uint64, h ExpiredObjectHandler) error
- func (db *DB) IterateOverGraveyard(h GraveHandler) error
- func (db *DB) ListWithCursor(prm *ListPrm) (res *ListRes, err error)
- func (db *DB) Movable(prm *MovablePrm) (*MovableRes, error)
- func (db *DB) Open() error
- func (db *DB) Put(prm *PutPrm) (res *PutRes, err error)
- func (db *DB) Reset() error
- func (db *DB) Select(prm *SelectPrm) (res *SelectRes, err error)
- func (db *DB) ToMoveIt(prm *ToMoveItPrm) (res *ToMoveItRes, err error)
- type DeletePrm
- type DeleteRes
- type DoNotMovePrm
- type DoNotMoveRes
- type ExistsPrm
- type ExistsRes
- type ExpiredObject
- type ExpiredObjectHandler
- type GetPrm
- type GetRes
- type Grave
- type GraveHandler
- type Info
- type InhumePrm
- type InhumeRes
- type IsSmallPrm
- type IsSmallRes
- type ListPrm
- type ListRes
- type MovablePrm
- type MovableRes
- type Option
- type PutPrm
- type PutRes
- type SelectPrm
- type SelectRes
- type ToMoveItPrm
- type ToMoveItRes
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownObjectType = errors.New("unknown object type") ErrIncorrectSplitInfoUpdate = errors.New("updating split info on object without it") ErrIncorrectRootObject = errors.New("invalid root object") )
var ErrEndOfListing = errors.New("end of object listing")
ErrEndOfListing is returned from object listing with cursor when storage can't return any more objects after provided cursor. Use nil cursor object to start listing again.
var ErrInterruptIterator = errors.New("iterator is interrupted")
ErrInterruptIterator is returned by iteration handlers as a "break" keyword.
var ErrLackSplitInfo = errors.New("no split info on parent object")
var ErrMissingContainerID = errors.New("missing container id field")
Functions ¶
func Inhume ¶ added in v0.13.0
Inhume inhumes the object by specified address.
tomb should not be nil.
func IsSmall ¶ added in v0.13.0
IsSmall wraps work with DB.IsSmall method with specified address and other parameters by default. Returns only the blobovnicza identifier.
Types ¶
type CleanUpPrm ¶ added in v0.13.0
type CleanUpPrm struct{}
CleanUpPrm groups the parameters of CleanUp operation.
type CleanUpRes ¶ added in v0.13.0
type CleanUpRes struct{}
CleanUpRes groups resulting values of CleanUp operation.
type Cursor ¶ added in v0.27.0
type Cursor struct {
// contains filtered or unexported fields
}
Cursor is a type for continuous object listing.
func ListWithCursor ¶ added in v0.27.0
ListWithCursor lists physical objects available in metabase starting from cursor. Includes regular, tombstone and storage group objects. Does not include inhumed objects. Use cursor value from response for consecutive requests.
Returns ErrEndOfListing if there are no more objects to return or count parameter set to zero.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents local metabase of storage node.
func (*DB) CleanUp ¶ added in v0.13.0
func (db *DB) CleanUp(prm *CleanUpPrm) (res *CleanUpRes, err error)
CleanUp removes empty buckets from metabase.
func (*DB) ContainerSize ¶ added in v0.15.0
func (*DB) DoNotMove ¶ added in v0.13.0
func (db *DB) DoNotMove(prm *DoNotMovePrm) (res *DoNotMoveRes, err error)
DoNotMove removes `MoveIt` mark from the object.
func (*DB) Exists ¶ added in v0.13.0
Exists returns ErrAlreadyRemoved if addr was marked as removed. Otherwise it returns true if addr is in primary index or false if it is not.
func (*DB) Inhume ¶ added in v0.13.0
Inhume marks objects as removed but not removes it from metabase.
func (*DB) Init ¶ added in v0.13.0
Init initializes metabase. It creates static (CID-independent) buckets in underlying BoltDB instance.
Does nothing if metabase has already been initialized and filled. To roll back the database to its initial state, use Reset.
func (*DB) IsSmall ¶ added in v0.13.0
func (db *DB) IsSmall(prm *IsSmallPrm) (res *IsSmallRes, err error)
IsSmall returns blobovniczaID for small objects and nil for big objects. Small objects stored in blobovnicza instances. Big objects stored in FS by shallow path which is calculated from address and therefore it is not indexed in metabase.
func (*DB) IterateCoveredByTombstones ¶ added in v0.16.0
func (db *DB) IterateCoveredByTombstones(tss map[string]struct{}, h func(*object.Address) error) error
IterateCoveredByTombstones iterates over all objects in DB which are covered by tombstone with string address from tss.
If h returns ErrInterruptIterator, nil returns immediately. Returns other errors of h directly.
Does not modify tss.
func (*DB) IterateExpired ¶ added in v0.16.0
func (db *DB) IterateExpired(epoch uint64, h ExpiredObjectHandler) error
IterateExpired iterates over all objects in DB which are out of date relative to epoch.
If h returns ErrInterruptIterator, nil returns immediately. Returns other errors of h directly.
func (*DB) IterateOverGraveyard ¶ added in v0.16.0
func (db *DB) IterateOverGraveyard(h GraveHandler) error
IterateOverGraveyard iterates over all graves in DB.
If h returns ErrInterruptIterator, nil returns immediately. Returns other errors of h directly.
func (*DB) ListWithCursor ¶ added in v0.27.0
ListWithCursor lists physical objects available in metabase starting from cursor. Includes regular, tombstone and storage group objects. Does not include inhumed objects. Use cursor value from response for consecutive requests.
Returns ErrEndOfListing if there are no more objects to return or count parameter set to zero.
func (*DB) Movable ¶ added in v0.13.0
func (db *DB) Movable(prm *MovablePrm) (*MovableRes, error)
Movable returns list of marked objects to move into other shard.
func (*DB) Put ¶
Put saves object header in metabase. Object payload expected to be cut. Big objects have nil blobovniczaID.
func (*DB) Reset ¶ added in v0.25.0
Reset resets metabase. Works similar to Init but cleans up all static buckets and removes all dynamic (CID-dependent) ones in non-blank BoltDB instances.
func (*DB) ToMoveIt ¶ added in v0.13.0
func (db *DB) ToMoveIt(prm *ToMoveItPrm) (res *ToMoveItRes, err error)
ToMoveIt marks objects to move it into another shard. This useful for faster HRW fetching.
type DeletePrm ¶ added in v0.13.0
type DeletePrm struct {
// contains filtered or unexported fields
}
DeletePrm groups the parameters of Delete operation.
type DeleteRes ¶ added in v0.13.0
type DeleteRes struct{}
DeleteRes groups resulting values of Delete operation.
type DoNotMovePrm ¶ added in v0.13.0
type DoNotMovePrm struct {
// contains filtered or unexported fields
}
DoNotMovePrm groups the parameters of DoNotMove operation.
func (*DoNotMovePrm) WithAddress ¶ added in v0.13.0
func (p *DoNotMovePrm) WithAddress(addr *objectSDK.Address) *DoNotMovePrm
WithAddress sets address of the object to prevent moving into another shard.
type DoNotMoveRes ¶ added in v0.13.0
type DoNotMoveRes struct{}
DoNotMoveRes groups resulting values of DoNotMove operation.
type ExistsPrm ¶ added in v0.13.0
type ExistsPrm struct {
// contains filtered or unexported fields
}
ExistsPrm groups the parameters of Exists operation.
type ExistsRes ¶ added in v0.13.0
type ExistsRes struct {
// contains filtered or unexported fields
}
ExistsRes groups resulting values of Exists operation.
type ExpiredObject ¶ added in v0.16.0
type ExpiredObject struct {
// contains filtered or unexported fields
}
ExpiredObject is a descriptor of expired object from DB.
func (*ExpiredObject) Address ¶ added in v0.16.0
func (e *ExpiredObject) Address() *object.Address
Address returns address of the expired object.
func (*ExpiredObject) Type ¶ added in v0.16.0
func (e *ExpiredObject) Type() object.Type
Type returns type of the expired object.
type ExpiredObjectHandler ¶ added in v0.16.0
type ExpiredObjectHandler func(*ExpiredObject) error
ExpiredObjectHandler is an ExpiredObject handling function.
type GetPrm ¶ added in v0.13.0
type GetPrm struct {
// contains filtered or unexported fields
}
GetPrm groups the parameters of Get operation.
func (*GetPrm) WithAddress ¶ added in v0.13.0
WithAddress is a Get option to set the address of the requested object.
Option is required.
type GetRes ¶ added in v0.13.0
type GetRes struct {
// contains filtered or unexported fields
}
GetRes groups resulting values of Get operation.
type Grave ¶ added in v0.16.0
type Grave struct {
// contains filtered or unexported fields
}
Grave represents descriptor of DB's graveyard item.
func (*Grave) WithGCMark ¶ added in v0.16.0
WithGCMark returns true if grave marked for GC to be removed.
type GraveHandler ¶ added in v0.16.0
GraveHandler is a Grave handling function.
type Info ¶ added in v0.13.0
type Info struct { // Full path to the metabase. Path string // Permission of database file. Permission fs.FileMode }
Info groups the information about DB.
type InhumePrm ¶ added in v0.13.0
type InhumePrm struct {
// contains filtered or unexported fields
}
InhumePrm encapsulates parameters for Inhume operation.
func (*InhumePrm) WithAddresses ¶ added in v0.16.0
WithAddresses sets list of object addresses that should be inhumed.
func (*InhumePrm) WithGCMark ¶ added in v0.16.0
WithGCMark marks the object to be physically removed.
Should not be called along with WithTombstoneAddress.
type InhumeRes ¶ added in v0.13.0
type InhumeRes struct{}
InhumeRes encapsulates results of Inhume operation.
type IsSmallPrm ¶ added in v0.13.0
type IsSmallPrm struct {
// contains filtered or unexported fields
}
IsSmallPrm groups the parameters of IsSmall operation.
func (*IsSmallPrm) WithAddress ¶ added in v0.13.0
func (p *IsSmallPrm) WithAddress(addr *objectSDK.Address) *IsSmallPrm
WithAddress is a IsSmall option to set the object address to check.
type IsSmallRes ¶ added in v0.13.0
type IsSmallRes struct {
// contains filtered or unexported fields
}
IsSmallRes groups resulting values of IsSmall operation.
func (*IsSmallRes) BlobovniczaID ¶ added in v0.13.0
func (r *IsSmallRes) BlobovniczaID() *blobovnicza.ID
BlobovniczaID returns blobovnicza identifier.
type ListPrm ¶ added in v0.27.0
type ListPrm struct {
// contains filtered or unexported fields
}
ListPrm contains parameters for ListWithCursor operation.
func (*ListPrm) WithCount ¶ added in v0.27.0
WithCount sets maximum amount of addresses that ListWithCursor should return.
func (*ListPrm) WithCursor ¶ added in v0.27.0
WithCursor sets cursor for ListWithCursor operation. For initial request ignore this param or use nil value. For consecutive requests, use value from ListRes.
type ListRes ¶ added in v0.27.0
type ListRes struct {
// contains filtered or unexported fields
}
ListRes contains values returned from ListWithCursor operation.
func (ListRes) AddressList ¶ added in v0.27.0
AddressList returns addresses selected by ListWithCursor operation.
type MovablePrm ¶ added in v0.13.0
type MovablePrm struct{}
MovablePrm groups the parameters of Movable operation.
type MovableRes ¶ added in v0.13.0
type MovableRes struct {
// contains filtered or unexported fields
}
MovableRes groups resulting values of Movable operation.
func (*MovableRes) AddressList ¶ added in v0.13.0
func (p *MovableRes) AddressList() []*objectSDK.Address
AddressList returns resulting addresses of Movable operation.
type Option ¶
type Option func(*cfg)
Option is an option of DB constructor.
func WithBoltDBOptions ¶ added in v0.13.0
WithBoltDBOptions returns option to specify BoltDB options.
func WithLogger ¶
WithLogger returns option to set logger of DB.
func WithPermissions ¶ added in v0.13.0
WithPermissions returns option to specify permission bits of Metabase system path.
type PutPrm ¶ added in v0.13.0
type PutPrm struct {
// contains filtered or unexported fields
}
PutPrm groups the parameters of Put operation.
func (*PutPrm) WithBlobovniczaID ¶ added in v0.13.0
func (p *PutPrm) WithBlobovniczaID(id *blobovnicza.ID) *PutPrm
WithBlobovniczaID is a Put option to set blobovnicza ID to save.
type PutRes ¶ added in v0.13.0
type PutRes struct{}
PutRes groups resulting values of Put operation.
type SelectPrm ¶ added in v0.13.0
type SelectPrm struct {
// contains filtered or unexported fields
}
SelectPrm groups the parameters of Select operation.
func (*SelectPrm) WithContainerID ¶ added in v0.13.0
WithContainerID is a Select option to set the container id to search in.
func (*SelectPrm) WithFilters ¶ added in v0.13.0
func (p *SelectPrm) WithFilters(fs object.SearchFilters) *SelectPrm
WithFilters is a Select option to set the object filters.
type SelectRes ¶ added in v0.13.0
type SelectRes struct {
// contains filtered or unexported fields
}
SelectRes groups resulting values of Select operation.
func (*SelectRes) AddressList ¶ added in v0.13.0
AddressList returns list of addresses of the selected objects.
type ToMoveItPrm ¶ added in v0.13.0
type ToMoveItPrm struct {
// contains filtered or unexported fields
}
ToMoveItPrm groups the parameters of ToMoveIt operation.
func (*ToMoveItPrm) WithAddress ¶ added in v0.13.0
func (p *ToMoveItPrm) WithAddress(addr *objectSDK.Address) *ToMoveItPrm
WithAddress sets address of the object to move into another shard.
type ToMoveItRes ¶ added in v0.13.0
type ToMoveItRes struct{}
ToMoveItRes groups resulting values of ToMoveIt operation.