33 lines
803 B
Go
33 lines
803 B
Go
package blobstorconfig
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/engine/shard/blobstor/storage"
|
|
)
|
|
|
|
// Config is a wrapper over the config section
|
|
// which provides access to BlobStor configurations.
|
|
type Config config.Config
|
|
|
|
// From wraps config section into Config.
|
|
func From(c *config.Config) *Config {
|
|
return (*Config)(c)
|
|
}
|
|
|
|
// Storages returns the value of storage subcomponents.
|
|
func (x *Config) Storages() []*storage.Config {
|
|
var ss []*storage.Config
|
|
for i := 0; ; i++ {
|
|
typ := config.String(
|
|
(*config.Config)(x),
|
|
strconv.Itoa(i)+".type")
|
|
if typ == "" {
|
|
return ss
|
|
}
|
|
|
|
sub := storage.From((*config.Config)(x).Sub(strconv.Itoa(i)))
|
|
ss = append(ss, sub)
|
|
}
|
|
}
|