frostfs-node/pkg/local_object_storage/blobstor/fstree/option.go
Dmitrii Stepanov 58c8722c81 [#585] fstree: Add optional file counter
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-08-16 14:47:44 +03:00

53 lines
822 B
Go

package fstree
import (
"io/fs"
utilSync "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/sync"
)
type Option func(*FSTree)
func WithDepth(d uint64) Option {
return func(f *FSTree) {
f.Depth = d
}
}
func WithDirNameLen(l int) Option {
return func(f *FSTree) {
f.DirNameLen = l
}
}
func WithPerm(p fs.FileMode) Option {
return func(f *FSTree) {
f.Permissions = p
}
}
func WithPath(p string) Option {
return func(f *FSTree) {
f.RootPath = p
}
}
func WithNoSync(noSync bool) Option {
return func(f *FSTree) {
f.noSync = noSync
}
}
func WithMetrics(m Metrics) Option {
return func(f *FSTree) {
f.metrics = m
}
}
func WithFileCounter(c FileCounter) Option {
return func(f *FSTree) {
f.fileCounterEnabled = true
f.fileCounter = c
f.fileGuard = utilSync.NewKeyLocker[string]()
}
}