diff --git a/pkg/services/object/acl/eacl/v2/headers.go b/pkg/services/object/acl/eacl/v2/headers.go index e6b352155..e116c0b65 100644 --- a/pkg/services/object/acl/eacl/v2/headers.go +++ b/pkg/services/object/acl/eacl/v2/headers.go @@ -46,7 +46,7 @@ type headerSource struct { } func (c *cfg) initDefault() { - c.storage = new(localStorage) + c.storage = (*localStorage)(nil) } func NewMessageHeaderSource(opts ...Option) (eaclSDK.TypedHeaderSource, error) { diff --git a/pkg/services/object/acl/eacl/v2/localstore.go b/pkg/services/object/acl/eacl/v2/localstore.go index 63020cbc1..255640fc3 100644 --- a/pkg/services/object/acl/eacl/v2/localstore.go +++ b/pkg/services/object/acl/eacl/v2/localstore.go @@ -8,14 +8,12 @@ import ( oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id" ) -type localStorage struct { - ls *engine.StorageEngine -} +type localStorage engine.StorageEngine func (s *localStorage) Head(addr oid.Address) (*objectSDK.Object, error) { - if s.ls == nil { + if s == nil { return nil, io.ErrUnexpectedEOF } - return engine.Head(s.ls, addr) + return engine.Head((*engine.StorageEngine)(s), addr) } diff --git a/pkg/services/object/acl/eacl/v2/opts.go b/pkg/services/object/acl/eacl/v2/opts.go index b6f86520b..9079535ba 100644 --- a/pkg/services/object/acl/eacl/v2/opts.go +++ b/pkg/services/object/acl/eacl/v2/opts.go @@ -14,9 +14,7 @@ func WithObjectStorage(v ObjectStorage) Option { func WithLocalObjectStorage(v *engine.StorageEngine) Option { return func(c *cfg) { - c.storage = &localStorage{ - ls: v, - } + c.storage = (*localStorage)(v) } } diff --git a/pkg/services/object/get/service.go b/pkg/services/object/get/service.go index 110613c88..b69ef8979 100644 --- a/pkg/services/object/get/service.go +++ b/pkg/services/object/get/service.go @@ -53,7 +53,6 @@ type epochSource interface { func (c *cfg) initDefault() { c.log = &logger.Logger{Logger: zap.L()} - c.localStorage = new(storageEngineWrapper) c.assembly = true c.clientCache = new(clientCacheWrapper) } @@ -89,7 +88,7 @@ func WithoutAssembly() Option { // instance. func WithLocalStorageEngine(e *engine.StorageEngine) Option { return func(c *cfg) { - c.localStorage.(*storageEngineWrapper).engine = e + c.localStorage = (*storageEngineWrapper)(e) } } diff --git a/pkg/services/object/get/util.go b/pkg/services/object/get/util.go index 9abf17e90..88cb896e2 100644 --- a/pkg/services/object/get/util.go +++ b/pkg/services/object/get/util.go @@ -27,9 +27,7 @@ type clientWrapper struct { client coreclient.MultiAddressClient } -type storageEngineWrapper struct { - engine *engine.StorageEngine -} +type storageEngineWrapper engine.StorageEngine type partWriter struct { ObjectWriter @@ -190,13 +188,14 @@ func (c *clientWrapper) get(exec *execCtx, key *ecdsa.PrivateKey) (*object.Objec return res.Object(), nil } -func (e *storageEngineWrapper) get(exec *execCtx) (*object.Object, error) { +func (w *storageEngineWrapper) get(exec *execCtx) (*object.Object, error) { + e := (*engine.StorageEngine)(w) if exec.headOnly { var headPrm engine.HeadPrm headPrm.WithAddress(exec.prm.addr) headPrm.WithRaw(exec.prm.raw) - r, err := e.engine.Head(headPrm) + r, err := e.Head(headPrm) if err != nil { return nil, err } @@ -207,7 +206,7 @@ func (e *storageEngineWrapper) get(exec *execCtx) (*object.Object, error) { getRange.WithAddress(exec.prm.addr) getRange.WithPayloadRange(rng) - r, err := e.engine.GetRange(getRange) + r, err := e.GetRange(getRange) if err != nil { return nil, err } @@ -217,7 +216,7 @@ func (e *storageEngineWrapper) get(exec *execCtx) (*object.Object, error) { var getPrm engine.GetPrm getPrm.WithAddress(exec.prm.addr) - r, err := e.engine.Get(getPrm) + r, err := e.Get(getPrm) if err != nil { return nil, err }