frostfs-node/pkg/services/object/acl/eacl/v2/opts.go
Pavel Karpy 57c5fccc8c [#1428] node/acl: Make OID optional
Not all the NeoFS requests must contain OID in their bodies (or must NOT
contain them at all). Do not pass object address in helper functions, pass
CID and OID separately instead.
Also, fixed NPE in the ACL service: updated SDK library brought errors
when working with `Put` and `Search` requests without OID fields.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-05-25 12:11:03 +03:00

50 lines
859 B
Go

package v2
import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
cidSDK "github.com/nspcc-dev/neofs-sdk-go/container/id"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
)
func WithObjectStorage(v ObjectStorage) Option {
return func(c *cfg) {
c.storage = v
}
}
func WithLocalObjectStorage(v *engine.StorageEngine) Option {
return func(c *cfg) {
c.storage = &localStorage{
ls: v,
}
}
}
func WithServiceRequest(v Request) Option {
return func(c *cfg) {
c.msg = requestXHeaderSource{
req: v,
}
}
}
func WithServiceResponse(resp Response, req Request) Option {
return func(c *cfg) {
c.msg = responseXHeaderSource{
resp: resp,
req: req,
}
}
}
func WithCID(v cidSDK.ID) Option {
return func(c *cfg) {
c.cid = v
}
}
func WithOID(v *oidSDK.ID) Option {
return func(c *cfg) {
c.oid = v
}
}