Dmitrii Stepanov
29fe8c41f3
All checks were successful
DCO action / DCO (pull_request) Successful in 1m42s
Build / Build Components (1.21) (pull_request) Successful in 3m23s
Vulncheck / Vulncheck (pull_request) Successful in 3m25s
Build / Build Components (1.20) (pull_request) Successful in 4m16s
Tests and linters / Staticcheck (pull_request) Successful in 4m24s
Tests and linters / Lint (pull_request) Successful in 5m2s
Tests and linters / Tests (1.20) (pull_request) Successful in 5m36s
Tests and linters / Tests (1.21) (pull_request) Successful in 6m42s
Tests and linters / Tests with -race (pull_request) Successful in 7m18s
The only one usage was for logging. Now logging performed by storage anyway. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
61 lines
1 KiB
Go
61 lines
1 KiB
Go
package fstree
|
|
|
|
import (
|
|
"io/fs"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
|
utilSync "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/sync"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
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]()
|
|
}
|
|
}
|
|
|
|
func WithLogger(l *logger.Logger) Option {
|
|
return func(f *FSTree) {
|
|
f.log = &logger.Logger{Logger: l.With(zap.String("component", "FSTree"))}
|
|
}
|
|
}
|