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
47 lines
1 KiB
Go
47 lines
1 KiB
Go
package fstree
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/fstree"
|
|
)
|
|
|
|
// Config is a wrapper over the config section
|
|
// which provides access to Blobovnicza configurations.
|
|
type Config config.Config
|
|
|
|
// DepthDefault is a default shallow dir depth.
|
|
const DepthDefault = 4
|
|
|
|
// From wraps config section into Config.
|
|
func From(c *config.Config) *Config {
|
|
return (*Config)(c)
|
|
}
|
|
|
|
// Type returns the storage type.
|
|
func (x *Config) Type() string {
|
|
return fstree.Type
|
|
}
|
|
|
|
// Depth returns the value of "depth" config parameter.
|
|
//
|
|
// Returns DepthDefault if the value is out of
|
|
// [1:fstree.MaxDepth] range.
|
|
func (x *Config) Depth() uint64 {
|
|
d := config.UintSafe(
|
|
(*config.Config)(x),
|
|
"depth",
|
|
)
|
|
|
|
if d >= 1 && d <= fstree.MaxDepth {
|
|
return d
|
|
}
|
|
|
|
return DepthDefault
|
|
}
|
|
|
|
// NoSync returns the value of "no_sync" config parameter.
|
|
//
|
|
// Returns false if the value is not a boolean or is missing.
|
|
func (x *Config) NoSync() bool {
|
|
return true
|
|
}
|