[#1764] neofs-node: Use constants for storage types

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-09-20 15:42:56 +03:00 committed by fyrchik
parent 9113793688
commit 6f45cc81fc
6 changed files with 16 additions and 7 deletions

View file

@ -446,7 +446,7 @@ func initShardOptions(c *cfg) {
var st []blobstor.SubStorage
for i := range storages {
switch storages[i].Type() {
case "blobovnicza":
case blobovniczatree.Type:
sub := blobovniczaconfig.From((*config.Config)(storages[i]))
lim := sc.SmallSizeLimit()
st = append(st, blobstor.SubStorage{
@ -462,7 +462,7 @@ func initShardOptions(c *cfg) {
return uint64(len(data)) < lim
},
})
case "fstree":
case fstree.Type:
sub := fstreeconfig.From((*config.Config)(storages[i]))
st = append(st, blobstor.SubStorage{
Storage: fstree.New(

View file

@ -3,6 +3,7 @@ package blobovniczaconfig
import (
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
boltdbconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine/shard/boltdb"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/blobovniczatree"
)
// Config is a wrapper over the config section
@ -31,7 +32,7 @@ func From(c *config.Config) *Config {
// Type returns the storage type.
func (x *Config) Type() string {
return "blobovnicza"
return blobovniczatree.Type
}
// Size returns the value of "size" config parameter.

View file

@ -5,6 +5,8 @@ import (
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine/shard/blobstor/storage"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/blobovniczatree"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
)
// Config is a wrapper over the config section
@ -26,7 +28,7 @@ func (x *Config) Storages() []*storage.Config {
switch typ {
case "":
return ss
case "fstree", "blobovnicza":
case fstree.Type, blobovniczatree.Type:
sub := storage.From((*config.Config)(x).Sub(strconv.Itoa(i)))
ss = append(ss, sub)
default:

View file

@ -19,7 +19,7 @@ func From(c *config.Config) *Config {
// Type returns the storage type.
func (x *Config) Type() string {
return "fstree"
return fstree.Type
}
// Depth returns the value of "depth" config parameter.

View file

@ -229,9 +229,12 @@ func u64FromHexString(str string) uint64 {
return v
}
// Type is blobovniczatree storage type used in logs and configuration.
const Type = "blobovnicza"
// Type implements common.Storage.
func (b *Blobovniczas) Type() string {
return "blobovnicza"
return Type
}
// SetCompressor implements common.Storage.

View file

@ -330,9 +330,12 @@ func (t *FSTree) NumberOfObjects() (uint64, error) {
return counter, nil
}
// Type is fstree storage type used in logs and configuration.
const Type = "fstree"
// Type implements common.Storage.
func (*FSTree) Type() string {
return "fstree"
return Type
}
// SetCompressor implements common.Storage.