frostfs-node/cmd/neofs-node/modules/node/core.go
Stanislav Bogatyrev b7b5079934 Add Inner Ring code
2020-07-24 17:07:37 +03:00

35 lines
760 B
Go

package node
import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/bucket"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/bucket/boltdb"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/bucket/fsbucket"
"github.com/spf13/viper"
)
type Buckets map[string]bucket.Bucket
const (
fsBucket = "fsbucket"
boltBucket = "bolt"
)
func newBuckets(v *viper.Viper) (Buckets, error) {
var (
err error
mBuckets = make(Buckets)
)
if mBuckets[fsBucket], err = fsbucket.NewBucket(v); err != nil {
return nil, err
}
boltOpts, err := boltdb.NewOptions(v)
if err != nil {
return nil, err
} else if mBuckets[boltBucket], err = boltdb.NewBucket(&boltOpts); err != nil {
return nil, err
}
return mBuckets, nil
}