2022-07-11 12:34:17 +00:00
|
|
|
package fstree
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/fs"
|
2023-08-11 08:32:43 +00:00
|
|
|
|
2023-11-15 11:18:03 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
|
|
|
"go.uber.org/zap"
|
2022-07-11 12:34:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Option func(*FSTree)
|
|
|
|
|
2022-09-26 16:38:03 +00:00
|
|
|
func WithDepth(d uint64) Option {
|
2022-07-11 12:34:17 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2022-10-28 09:57:36 +00:00
|
|
|
|
|
|
|
func WithNoSync(noSync bool) Option {
|
|
|
|
return func(f *FSTree) {
|
|
|
|
f.noSync = noSync
|
|
|
|
}
|
|
|
|
}
|
2023-06-02 13:04:02 +00:00
|
|
|
|
|
|
|
func WithMetrics(m Metrics) Option {
|
|
|
|
return func(f *FSTree) {
|
|
|
|
f.metrics = m
|
|
|
|
}
|
|
|
|
}
|
2023-08-11 08:32:43 +00:00
|
|
|
|
|
|
|
func WithFileCounter(c FileCounter) Option {
|
|
|
|
return func(f *FSTree) {
|
|
|
|
f.fileCounter = c
|
|
|
|
}
|
|
|
|
}
|
2023-11-15 11:18:03 +00:00
|
|
|
|
|
|
|
func WithLogger(l *logger.Logger) Option {
|
|
|
|
return func(f *FSTree) {
|
2024-10-21 07:22:54 +00:00
|
|
|
f.log = l.With(zap.String("component", "FSTree"))
|
2023-11-15 11:18:03 +00:00
|
|
|
}
|
|
|
|
}
|