forked from TrueCloudLab/frostfs-node
[#207] aclsvc: Refactor object headers read
Resolve funlen linter for readObjectHeaders method. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
b0623e69aa
commit
eafbb9215e
1 changed files with 84 additions and 77 deletions
|
@ -101,12 +101,18 @@ func requestHeaders(msg xHeaderSource) []eaclSDK.Header {
|
||||||
|
|
||||||
var errMissingOID = errors.New("object ID is missing")
|
var errMissingOID = errors.New("object ID is missing")
|
||||||
|
|
||||||
// nolint: funlen
|
|
||||||
func (h *cfg) readObjectHeaders(dst *headerSource) error {
|
func (h *cfg) readObjectHeaders(dst *headerSource) error {
|
||||||
switch m := h.msg.(type) {
|
switch m := h.msg.(type) {
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("unexpected message type %T", h.msg))
|
panic(fmt.Sprintf("unexpected message type %T", h.msg))
|
||||||
case requestXHeaderSource:
|
case requestXHeaderSource:
|
||||||
|
return h.readObjectHeadersFromRequestXHeaderSource(m, dst)
|
||||||
|
case responseXHeaderSource:
|
||||||
|
return h.readObjectHeadersResponseXHeaderSource(m, dst)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *cfg) readObjectHeadersFromRequestXHeaderSource(m requestXHeaderSource, dst *headerSource) error {
|
||||||
switch req := m.req.(type) {
|
switch req := m.req.(type) {
|
||||||
case
|
case
|
||||||
*objectV2.GetRequest,
|
*objectV2.GetRequest,
|
||||||
|
@ -148,7 +154,10 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error {
|
||||||
|
|
||||||
dst.objectHeaders = []eaclSDK.Header{cidHeader(cnr)}
|
dst.objectHeaders = []eaclSDK.Header{cidHeader(cnr)}
|
||||||
}
|
}
|
||||||
case responseXHeaderSource:
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *cfg) readObjectHeadersResponseXHeaderSource(m responseXHeaderSource, dst *headerSource) error {
|
||||||
switch resp := m.resp.(type) {
|
switch resp := m.resp.(type) {
|
||||||
default:
|
default:
|
||||||
objectHeaders, completed := h.localObjectHeaders(h.cnr, h.obj)
|
objectHeaders, completed := h.localObjectHeaders(h.cnr, h.obj)
|
||||||
|
@ -189,8 +198,6 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error {
|
||||||
|
|
||||||
dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), h.cnr, h.obj)
|
dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), h.cnr, h.obj)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue