Documentation ¶
Index ¶
- Constants
- type FSTree
- func (t *FSTree) Close() error
- func (t *FSTree) Compressor() *compression.Config
- func (t *FSTree) Delete(ctx context.Context, prm common.DeletePrm) (common.DeleteRes, error)
- func (t *FSTree) Exists(ctx context.Context, prm common.ExistsPrm) (common.ExistsRes, error)
- func (t *FSTree) Get(ctx context.Context, prm common.GetPrm) (common.GetRes, error)
- func (t *FSTree) GetRange(ctx context.Context, prm common.GetRangePrm) (common.GetRangeRes, error)
- func (t *FSTree) Init() error
- func (t *FSTree) Iterate(ctx context.Context, prm common.IteratePrm) (common.IterateRes, error)
- func (t *FSTree) ObjectsCount(ctx context.Context) (uint64, error)
- func (t *FSTree) Open(ro bool) error
- func (t *FSTree) Path() string
- func (t *FSTree) Put(ctx context.Context, prm common.PutPrm) (common.PutRes, error)
- func (t *FSTree) Rebuild(_ context.Context, _ common.RebuildPrm) (common.RebuildRes, error)
- func (t *FSTree) SetCompressor(cc *compression.Config)
- func (t *FSTree) SetParentID(parentID string)
- func (t *FSTree) SetReportErrorFunc(_ func(string, error))
- func (*FSTree) Type() string
- type FileCounter
- type Info
- type Metrics
- type Option
- type SimpleCounter
Constants ¶
View Source
const ( // DirNameLen is how many bytes is used to group keys into directories. DirNameLen = 1 // in bytes // MaxDepth is maximum depth of nested directories. MaxDepth = (sha256.Size - 1) / DirNameLen )
View Source
const Type = "fstree"
Type is fstree storage type used in logs and configuration.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FSTree ¶
type FSTree struct { Info *compression.Config Depth uint64 DirNameLen int // contains filtered or unexported fields }
FSTree represents an object storage as a filesystem tree.
func (*FSTree) Compressor ¶ added in v0.37.0
func (t *FSTree) Compressor() *compression.Config
func (*FSTree) Exists ¶
Exists returns the path to the file with object contents if it exists in the storage and an error otherwise.
func (*FSTree) GetRange ¶
func (t *FSTree) GetRange(ctx context.Context, prm common.GetRangePrm) (common.GetRangeRes, error)
GetRange implements common.Storage.
func (*FSTree) Iterate ¶
func (t *FSTree) Iterate(ctx context.Context, prm common.IteratePrm) (common.IterateRes, error)
Iterate iterates over all stored objects.
func (*FSTree) ObjectsCount ¶ added in v0.39.0
func (*FSTree) Rebuild ¶ added in v0.38.0
func (t *FSTree) Rebuild(_ context.Context, _ common.RebuildPrm) (common.RebuildRes, error)
func (*FSTree) SetCompressor ¶
func (t *FSTree) SetCompressor(cc *compression.Config)
SetCompressor implements common.Storage.
func (*FSTree) SetParentID ¶ added in v0.37.0
func (*FSTree) SetReportErrorFunc ¶
SetReportErrorFunc implements common.Storage.
type FileCounter ¶ added in v0.37.0
type FileCounter interface { Set(v uint64) Inc() Dec() }
FileCounter used to count files in FSTree. The implementation must be thread-safe.
type Info ¶
type Info struct { // Permission bits of the root directory. Permissions fs.FileMode // Full path to the root directory. RootPath string }
Info groups the information about file storage.
type Metrics ¶ added in v0.37.0
type Metrics interface { SetParentID(parentID string) SetMode(readOnly bool) Close() Iterate(d time.Duration, success bool) Delete(d time.Duration, success bool) Exists(d time.Duration, success bool) Put(d time.Duration, size int, success bool) Get(d time.Duration, size int, success bool) GetRange(d time.Duration, size int, success bool) ObjectsCount(d time.Duration, success bool) }
type Option ¶
type Option func(*FSTree)
func WithDirNameLen ¶
func WithFileCounter ¶ added in v0.37.0
func WithFileCounter(c FileCounter) Option
func WithLogger ¶ added in v0.38.0
func WithMetrics ¶ added in v0.37.0
func WithNoSync ¶
type SimpleCounter ¶ added in v0.37.0
type SimpleCounter struct {
// contains filtered or unexported fields
}
func NewSimpleCounter ¶ added in v0.37.0
func NewSimpleCounter() *SimpleCounter
func (*SimpleCounter) Dec ¶ added in v0.37.0
func (c *SimpleCounter) Dec()
func (*SimpleCounter) Inc ¶ added in v0.37.0
func (c *SimpleCounter) Inc()
func (*SimpleCounter) Set ¶ added in v0.37.0
func (c *SimpleCounter) Set(v uint64)
func (*SimpleCounter) Value ¶ added in v0.37.0
func (c *SimpleCounter) Value() uint64
Click to show internal directories.
Click to hide internal directories.