[#1463] blobovnicza: Remove pointers from struct members

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-06-01 14:05:26 +03:00 committed by fyrchik
parent d9f0ac8909
commit b602fff01f

View file

@ -13,9 +13,9 @@ import (
// Blobovnicza represents the implementation of NeoFS Blobovnicza. // Blobovnicza represents the implementation of NeoFS Blobovnicza.
type Blobovnicza struct { type Blobovnicza struct {
*cfg cfg
filled *atomic.Uint64 filled atomic.Uint64
boltDB *bbolt.DB boltDB *bbolt.DB
} }
@ -41,8 +41,8 @@ type boltDBCfg struct {
boltOptions *bbolt.Options boltOptions *bbolt.Options
} }
func defaultCfg() *cfg { func defaultCfg(с *cfg) {
return &cfg{ *с = cfg{
boltDBCfg: boltDBCfg{ boltDBCfg: boltDBCfg{
perm: os.ModePerm, // 0777 perm: os.ModePerm, // 0777
boltOptions: &bbolt.Options{ boltOptions: &bbolt.Options{
@ -57,16 +57,15 @@ func defaultCfg() *cfg {
// New creates and returns a new Blobovnicza instance. // New creates and returns a new Blobovnicza instance.
func New(opts ...Option) *Blobovnicza { func New(opts ...Option) *Blobovnicza {
c := defaultCfg() var b Blobovnicza
defaultCfg(&b.cfg)
for i := range opts { for i := range opts {
opts[i](c) opts[i](&b.cfg)
} }
return &Blobovnicza{ return &b
cfg: c,
filled: atomic.NewUint64(0),
}
} }
// WithPath returns option to set system path to Blobovnicza. // WithPath returns option to set system path to Blobovnicza.