60 lines
1.2 KiB
Go
60 lines
1.2 KiB
Go
package blobtreeconfig
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/blobtree"
|
|
)
|
|
|
|
// Config is a wrapper over the config section
|
|
// which provides access to Blobtree configurations.
|
|
type Config config.Config
|
|
|
|
const (
|
|
// SizeDefault is a default limit of estimates of single Blobtree file size.
|
|
SizeDefault = 4 * 1024 * 1024
|
|
|
|
// DepthDefault is a default shallow dir depth.
|
|
DepthDefault = 8
|
|
)
|
|
|
|
// 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 blobtree.Type
|
|
}
|
|
|
|
// Size returns the value of "size" config parameter.
|
|
//
|
|
// Returns SizeDefault if the value is not a positive number.
|
|
func (x *Config) Size() uint64 {
|
|
s := config.SizeInBytesSafe(
|
|
(*config.Config)(x),
|
|
"size",
|
|
)
|
|
|
|
if s > 0 {
|
|
return s
|
|
}
|
|
|
|
return SizeDefault
|
|
}
|
|
|
|
// ShallowDepth returns the value of "depth" config parameter.
|
|
//
|
|
// Returns ShallowDepthDefault if the value is not a positive number.
|
|
func (x *Config) Depth() uint64 {
|
|
d := config.UintSafe(
|
|
(*config.Config)(x),
|
|
"depth",
|
|
)
|
|
|
|
if d > 0 {
|
|
return d
|
|
}
|
|
|
|
return DepthDefault
|
|
}
|