forked from TrueCloudLab/frostfs-node
26b4a258e0
1. Move compression parameters to the `shard` section. 2. Allow to use multiple sub-storage components in the blobstor. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
55 lines
951 B
Go
55 lines
951 B
Go
package storage
|
|
|
|
import (
|
|
"io/fs"
|
|
|
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
|
)
|
|
|
|
type Config config.Config
|
|
|
|
// PermDefault are default permission bits for BlobStor data.
|
|
const PermDefault = 0660
|
|
|
|
func From(x *config.Config) *Config {
|
|
return (*Config)(x)
|
|
}
|
|
|
|
// Type returns storage type.
|
|
func (x *Config) Type() string {
|
|
return config.String(
|
|
(*config.Config)(x),
|
|
"type")
|
|
}
|
|
|
|
// Path returns the value of "path" config parameter.
|
|
//
|
|
// Panics if the value is not a non-empty string.
|
|
func (x *Config) Path() string {
|
|
p := config.String(
|
|
(*config.Config)(x),
|
|
"path",
|
|
)
|
|
|
|
if p == "" {
|
|
panic("blobstor path not set")
|
|
}
|
|
|
|
return p
|
|
}
|
|
|
|
// Perm returns the value of "perm" config parameter as a fs.FileMode.
|
|
//
|
|
// Returns PermDefault if the value is not a non-zero number.
|
|
func (x *Config) Perm() fs.FileMode {
|
|
p := config.UintSafe(
|
|
(*config.Config)(x),
|
|
"perm",
|
|
)
|
|
|
|
if p == 0 {
|
|
p = PermDefault
|
|
}
|
|
|
|
return fs.FileMode(p)
|
|
}
|