frostfs-node/pkg/local_object_storage/blobstor/fstree/option.go
Alexander Chuprov b65370428f
Some checks failed
DCO action / DCO (pull_request) Failing after 2m30s
Tests and linters / Lint (pull_request) Failing after 4m9s
Vulncheck / Vulncheck (pull_request) Successful in 3m51s
Build / Build Components (1.21) (pull_request) Successful in 4m0s
Build / Build Components (1.20) (pull_request) Successful in 4m9s
Tests and linters / Tests (1.20) (pull_request) Successful in 5m17s
Tests and linters / Staticcheck (pull_request) Successful in 5m21s
Tests and linters / Tests (1.21) (pull_request) Successful in 5m56s
Tests and linters / Tests with -race (pull_request) Successful in 6m21s
Research Forgejo Runner
2023-11-24 13:53:26 +03:00

53 lines
820 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 = true
}
}
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]()
}
}