From c1cd32ecca4db7201970a96c17d83c6bb8ec19c5 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 24 Jan 2023 13:41:05 +0300 Subject: [PATCH] [#6] eacl/v2: Rename `cfg` receiver Signed-off-by: Evgenii Stratonikov --- pkg/services/object/acl/eacl/v2/headers.go | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pkg/services/object/acl/eacl/v2/headers.go b/pkg/services/object/acl/eacl/v2/headers.go index 63e733cf6..ae3bc8568 100644 --- a/pkg/services/object/acl/eacl/v2/headers.go +++ b/pkg/services/object/acl/eacl/v2/headers.go @@ -102,20 +102,20 @@ func requestHeaders(msg xHeaderSource) []eaclSDK.Header { var errMissingOID = errors.New("object ID is missing") // nolint: funlen -func (h *cfg) readObjectHeaders(dst *headerSource) error { - switch m := h.msg.(type) { +func (c *cfg) readObjectHeaders(dst *headerSource) error { + switch m := c.msg.(type) { default: - panic(fmt.Sprintf("unexpected message type %T", h.msg)) + panic(fmt.Sprintf("unexpected message type %T", c.msg)) case requestXHeaderSource: switch req := m.req.(type) { case *objectV2.GetRequest, *objectV2.HeadRequest: - if h.obj == nil { + if c.obj == nil { return errMissingOID } - objHeaders, completed := h.localObjectHeaders(h.cnr, h.obj) + objHeaders, completed := c.localObjectHeaders(c.cnr, c.obj) dst.objectHeaders = objHeaders dst.incompleteObjectHeaders = !completed @@ -123,18 +123,18 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error { *objectV2.GetRangeRequest, *objectV2.GetRangeHashRequest, *objectV2.DeleteRequest: - if h.obj == nil { + if c.obj == nil { return errMissingOID } - dst.objectHeaders = addressHeaders(h.cnr, h.obj) + dst.objectHeaders = addressHeaders(c.cnr, c.obj) case *objectV2.PutRequest: if v, ok := req.GetBody().GetObjectPart().(*objectV2.PutObjectPartInit); ok { oV2 := new(objectV2.Object) oV2.SetObjectID(v.GetObjectID()) oV2.SetHeader(v.GetHeader()) - dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), h.cnr, h.obj) + dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), c.cnr, c.obj) } case *objectV2.SearchRequest: cnrV2 := req.GetBody().GetContainerID() @@ -151,7 +151,7 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error { case responseXHeaderSource: switch resp := m.resp.(type) { default: - objectHeaders, completed := h.localObjectHeaders(h.cnr, h.obj) + objectHeaders, completed := c.localObjectHeaders(c.cnr, c.obj) dst.objectHeaders = objectHeaders dst.incompleteObjectHeaders = !completed @@ -161,7 +161,7 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error { oV2.SetObjectID(v.GetObjectID()) oV2.SetHeader(v.GetHeader()) - dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), h.cnr, h.obj) + dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), c.cnr, c.obj) } case *objectV2.HeadResponse: oV2 := new(objectV2.Object) @@ -173,7 +173,7 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error { hdr = new(objectV2.Header) var idV2 refsV2.ContainerID - h.cnr.WriteToV2(&idV2) + c.cnr.WriteToV2(&idV2) hdr.SetContainerID(&idV2) hdr.SetVersion(v.GetVersion()) @@ -187,20 +187,20 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error { oV2.SetHeader(hdr) - dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), h.cnr, h.obj) + dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), c.cnr, c.obj) } } return nil } -func (h *cfg) localObjectHeaders(cnr cid.ID, idObj *oid.ID) ([]eaclSDK.Header, bool) { +func (c *cfg) localObjectHeaders(cnr cid.ID, idObj *oid.ID) ([]eaclSDK.Header, bool) { if idObj != nil { var addr oid.Address addr.SetContainer(cnr) addr.SetObject(*idObj) - obj, err := h.storage.Head(addr) + obj, err := c.storage.Head(addr) if err == nil { return headersFromObject(obj, cnr, idObj), true }