Documentation ¶
Index ¶
- Constants
- type Blobovniczas
- func (b *Blobovniczas) Close() error
- func (b *Blobovniczas) Compressor() *compression.Config
- func (b *Blobovniczas) Delete(ctx context.Context, prm common.DeletePrm) (res common.DeleteRes, err error)
- func (b *Blobovniczas) Exists(ctx context.Context, prm common.ExistsPrm) (common.ExistsRes, error)
- func (b *Blobovniczas) Get(ctx context.Context, prm common.GetPrm) (res common.GetRes, err error)
- func (b *Blobovniczas) GetRange(ctx context.Context, prm common.GetRangePrm) (res common.GetRangeRes, err error)
- func (b *Blobovniczas) Init() error
- func (b *Blobovniczas) Iterate(ctx context.Context, prm common.IteratePrm) (common.IterateRes, error)
- func (b *Blobovniczas) ObjectsCount(ctx context.Context) (uint64, error)
- func (b *Blobovniczas) Open(mode mode.ComponentMode) error
- func (b *Blobovniczas) Path() string
- func (b *Blobovniczas) Put(ctx context.Context, prm common.PutPrm) (common.PutRes, error)
- func (b *Blobovniczas) Rebuild(ctx context.Context, prm common.RebuildPrm) (common.RebuildRes, error)
- func (b *Blobovniczas) SetCompressor(cc *compression.Config)
- func (b *Blobovniczas) SetParentID(parentID string)
- func (b *Blobovniczas) SetReportErrorFunc(f func(string, error))
- func (b *Blobovniczas) Type() string
- type ID
- type Metrics
- type Option
- func WithBlobovniczaShallowDepth(depth uint64) Option
- func WithBlobovniczaShallowWidth(width uint64) Option
- func WithBlobovniczaSize(sz uint64) Option
- func WithInitWorkerCount(v int) Option
- func WithLogger(l *logger.Logger) Option
- func WithMetrics(m Metrics) Option
- func WithMoveBatchSize(v int) Option
- func WithObjectSizeLimit(sz uint64) Option
- func WithOpenedCacheExpInterval(expInterval time.Duration) Option
- func WithOpenedCacheSize(sz int) Option
- func WithOpenedCacheTTL(ttl time.Duration) Option
- func WithPermissions(perm fs.FileMode) Option
- func WithRootPath(p string) Option
- func WithWaitBeforeDropDB(t time.Duration) Option
Constants ¶
const Type = "blobovnicza"
Type is blobovniczatree storage type used in logs and configuration.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blobovniczas ¶
type Blobovniczas struct {
// contains filtered or unexported fields
}
Blobovniczas represents the storage of the "small" objects.
Each object is stored in Blobovnicza's (B-s). B-s are structured in a multilevel directory hierarchy with fixed depth and width (configured by BlobStor).
Example (width = 4, depth = 3):
x===============================x |[0] [1] [2] [3]| | \ / | | \ / | | \ / | | \ / | |[0] [1] [2] [3]| | | / | | | / | | | / | | | / | |[0](F) [1](A) [X] [X]| x===============================x
Elements of the deepest level are B-s. B-s are allocated dynamically. At each moment of the time there is an active B (ex. A), set of already filled B-s (ex. F) and a list of not yet initialized B-s (ex. X). After filling the active B it becomes full, and next B becomes initialized and active.
Active B and some of the full B-s are cached (LRU). All cached B-s are intitialized and opened.
Object is saved as follows:
- at each level, according to HRW, the next one is selected and dives into it until we reach the deepest;
- at the B-s level object is saved to the active B. If active B is full, next B is opened, initialized and cached. If there is no more X candidates, goto 1 and process next level.
After the object is saved in B, path concatenation is returned in system path format as B identifier (ex. "0/1/1" or "3/2/1").
func NewBlobovniczaTree ¶
func NewBlobovniczaTree(ctx context.Context, opts ...Option) (blz *Blobovniczas)
NewBlobovniczaTree returns new instance of blobovniczas tree.
func (*Blobovniczas) Compressor ¶ added in v0.37.0
func (b *Blobovniczas) Compressor() *compression.Config
func (*Blobovniczas) Delete ¶
func (b *Blobovniczas) Delete(ctx context.Context, prm common.DeletePrm) (res common.DeleteRes, err error)
Delete deletes object from blobovnicza tree.
If blobocvnicza ID is specified, only this blobovnicza is processed. Otherwise, all Blobovniczas are processed descending weight.
func (*Blobovniczas) Get ¶
Get reads object from blobovnicza tree.
If blobocvnicza ID is specified, only this blobovnicza is processed. Otherwise, all Blobovniczas are processed descending weight.
func (*Blobovniczas) GetRange ¶
func (b *Blobovniczas) GetRange(ctx context.Context, prm common.GetRangePrm) (res common.GetRangeRes, err error)
GetRange reads range of object payload data from blobovnicza tree.
If blobocvnicza ID is specified, only this blobovnicza is processed. Otherwise, all Blobovniczas are processed descending weight.
func (*Blobovniczas) Init ¶
func (b *Blobovniczas) Init() error
Init initializes blobovnicza tree.
Should be called exactly once.
func (*Blobovniczas) Iterate ¶
func (b *Blobovniczas) Iterate(ctx context.Context, prm common.IteratePrm) (common.IterateRes, error)
Iterate iterates over all objects in b.
func (*Blobovniczas) ObjectsCount ¶ added in v0.39.0
func (b *Blobovniczas) ObjectsCount(ctx context.Context) (uint64, error)
func (*Blobovniczas) Open ¶
func (b *Blobovniczas) Open(mode mode.ComponentMode) error
Open opens blobovnicza tree.
func (*Blobovniczas) Put ¶
Put saves object in the maximum weight blobobnicza.
returns error if could not save object in any blobovnicza.
func (*Blobovniczas) Rebuild ¶ added in v0.38.0
func (b *Blobovniczas) Rebuild(ctx context.Context, prm common.RebuildPrm) (common.RebuildRes, error)
func (*Blobovniczas) SetCompressor ¶
func (b *Blobovniczas) SetCompressor(cc *compression.Config)
SetCompressor implements common.Storage.
func (*Blobovniczas) SetParentID ¶ added in v0.37.0
func (b *Blobovniczas) SetParentID(parentID string)
func (*Blobovniczas) SetReportErrorFunc ¶
func (b *Blobovniczas) SetReportErrorFunc(f func(string, error))
SetReportErrorFunc implements common.Storage.
type ID ¶ added in v0.38.0
type ID []byte
ID represents Blobovnicza identifier.
func NewIDFromBytes ¶ added in v0.38.0
NewIDFromBytes constructs an ID from a byte slice.
type Metrics ¶ added in v0.37.0
type Metrics interface { Blobovnicza() blobovnicza.Metrics SetParentID(parentID string) SetMode(mode.ComponentMode) Close() SetRebuildStatus(status string) ObjectMoved(d time.Duration) SetRebuildPercent(value uint32) ObjectsCount(d time.Duration, success bool) Delete(d time.Duration, success, withStorageID bool) Exists(d time.Duration, success, withStorageID bool) GetRange(d time.Duration, size int, success, withStorageID bool) Get(d time.Duration, size int, success, withStorageID bool) Iterate(d time.Duration, success bool) Put(d time.Duration, size int, success bool) }
type Option ¶
type Option func(*cfg)
func WithBlobovniczaSize ¶
func WithInitWorkerCount ¶ added in v0.38.0
WithInitWorkerCount sets maximum workers count to init blobovnicza tree.
Negative or zero value means no limit.