frostfs-node/pkg/local_object_storage/blobstor/fstree/option.go
Anton Nikiforov 5bf54e18ab
All checks were successful
DCO action / DCO (pull_request) Successful in 47s
Vulncheck / Vulncheck (pull_request) Successful in 1m5s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m34s
Build / Build Components (pull_request) Successful in 1m43s
Tests and linters / Staticcheck (pull_request) Successful in 2m46s
Tests and linters / Run gofumpt (pull_request) Successful in 2m49s
Tests and linters / Tests (pull_request) Successful in 3m47s
Tests and linters / gopls check (pull_request) Successful in 3m57s
Tests and linters / Tests with -race (pull_request) Successful in 4m45s
Tests and linters / Lint (pull_request) Successful in 2m56s
[#1619] logger: Set tags for node components
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2025-02-18 14:28:52 +03:00

58 lines
909 B
Go

package fstree
import (
"io/fs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
"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.fileCounter = c
}
}
func WithLogger(l *logger.Logger) Option {
return func(f *FSTree) {
f.log = l.With(zap.String("component", "FSTree")).WithTag(logger.TagFSTree)
}
}