From ce4e5e56b9be7f87f7cd9e0258d28e94b5749946 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 9 Feb 2024 11:33:56 +0300 Subject: [PATCH] aclsvc: Do not use functional options in NewMessageHeaderSource() There is only 1 option, which is provided on every callsite. Signed-off-by: Evgenii Stratonikov --- pkg/services/object/acl/acl.go | 2 +- pkg/services/object/acl/eacl/v2/eacl_test.go | 2 +- pkg/services/object/acl/eacl/v2/headers.go | 9 ++------- pkg/services/object/acl/eacl/v2/opts.go | 11 ----------- 4 files changed, 4 insertions(+), 20 deletions(-) delete mode 100644 pkg/services/object/acl/eacl/v2/opts.go diff --git a/pkg/services/object/acl/acl.go b/pkg/services/object/acl/acl.go index 921545c8b..fe58f07b9 100644 --- a/pkg/services/object/acl/acl.go +++ b/pkg/services/object/acl/acl.go @@ -181,7 +181,7 @@ func (c *Checker) getHeaderSource(cnr cid.ID, msg any, reqInfo v2.RequestInfo) ( xHeaderSource = eaclV2.NewResponseXHeaderSource(msg.(eaclV2.Response), reqInfo.Request().(eaclV2.Request)) } - hdrSrc, err := eaclV2.NewMessageHeaderSource(&localStorage{ls: c.localStorage}, xHeaderSource, cnr, eaclV2.WithOID(reqInfo.ObjectID())) + hdrSrc, err := eaclV2.NewMessageHeaderSource(&localStorage{ls: c.localStorage}, xHeaderSource, cnr, reqInfo.ObjectID()) if err != nil { return nil, fmt.Errorf("can't parse headers: %w", err) } diff --git a/pkg/services/object/acl/eacl/v2/eacl_test.go b/pkg/services/object/acl/eacl/v2/eacl_test.go index 023b99239..b5dfc9b82 100644 --- a/pkg/services/object/acl/eacl/v2/eacl_test.go +++ b/pkg/services/object/acl/eacl/v2/eacl_test.go @@ -106,7 +106,7 @@ func TestHeadRequest(t *testing.T) { lStorage, NewRequestXHeaderSource(req), addr.Container(), - WithOID(&id)) + &id) require.NoError(t, err) return hdrSrc } diff --git a/pkg/services/object/acl/eacl/v2/headers.go b/pkg/services/object/acl/eacl/v2/headers.go index 34975e1e6..378481357 100644 --- a/pkg/services/object/acl/eacl/v2/headers.go +++ b/pkg/services/object/acl/eacl/v2/headers.go @@ -16,8 +16,6 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" ) -type Option func(*cfg) - type cfg struct { storage ObjectStorage @@ -46,17 +44,14 @@ type headerSource struct { incompleteObjectHeaders bool } -func NewMessageHeaderSource(os ObjectStorage, xhs XHeaderSource, cnrID cid.ID, opts ...Option) (eaclSDK.TypedHeaderSource, error) { +func NewMessageHeaderSource(os ObjectStorage, xhs XHeaderSource, cnrID cid.ID, objID *oid.ID) (eaclSDK.TypedHeaderSource, error) { cfg := &cfg{ storage: os, cnr: cnrID, + obj: objID, msg: xhs, } - for i := range opts { - opts[i](cfg) - } - if cfg.msg == nil { return nil, errors.New("message is not provided") } diff --git a/pkg/services/object/acl/eacl/v2/opts.go b/pkg/services/object/acl/eacl/v2/opts.go deleted file mode 100644 index d91a21c75..000000000 --- a/pkg/services/object/acl/eacl/v2/opts.go +++ /dev/null @@ -1,11 +0,0 @@ -package v2 - -import ( - oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" -) - -func WithOID(v *oid.ID) Option { - return func(c *cfg) { - c.obj = v - } -}