forked from TrueCloudLab/frostfs-node
[#6] eacl/v2: Rename cfg
receiver
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
9fbcc0e43c
commit
c1cd32ecca
1 changed files with 14 additions and 14 deletions
|
@ -102,20 +102,20 @@ func requestHeaders(msg xHeaderSource) []eaclSDK.Header {
|
||||||
var errMissingOID = errors.New("object ID is missing")
|
var errMissingOID = errors.New("object ID is missing")
|
||||||
|
|
||||||
// nolint: funlen
|
// nolint: funlen
|
||||||
func (h *cfg) readObjectHeaders(dst *headerSource) error {
|
func (c *cfg) readObjectHeaders(dst *headerSource) error {
|
||||||
switch m := h.msg.(type) {
|
switch m := c.msg.(type) {
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("unexpected message type %T", h.msg))
|
panic(fmt.Sprintf("unexpected message type %T", c.msg))
|
||||||
case requestXHeaderSource:
|
case requestXHeaderSource:
|
||||||
switch req := m.req.(type) {
|
switch req := m.req.(type) {
|
||||||
case
|
case
|
||||||
*objectV2.GetRequest,
|
*objectV2.GetRequest,
|
||||||
*objectV2.HeadRequest:
|
*objectV2.HeadRequest:
|
||||||
if h.obj == nil {
|
if c.obj == nil {
|
||||||
return errMissingOID
|
return errMissingOID
|
||||||
}
|
}
|
||||||
|
|
||||||
objHeaders, completed := h.localObjectHeaders(h.cnr, h.obj)
|
objHeaders, completed := c.localObjectHeaders(c.cnr, c.obj)
|
||||||
|
|
||||||
dst.objectHeaders = objHeaders
|
dst.objectHeaders = objHeaders
|
||||||
dst.incompleteObjectHeaders = !completed
|
dst.incompleteObjectHeaders = !completed
|
||||||
|
@ -123,18 +123,18 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error {
|
||||||
*objectV2.GetRangeRequest,
|
*objectV2.GetRangeRequest,
|
||||||
*objectV2.GetRangeHashRequest,
|
*objectV2.GetRangeHashRequest,
|
||||||
*objectV2.DeleteRequest:
|
*objectV2.DeleteRequest:
|
||||||
if h.obj == nil {
|
if c.obj == nil {
|
||||||
return errMissingOID
|
return errMissingOID
|
||||||
}
|
}
|
||||||
|
|
||||||
dst.objectHeaders = addressHeaders(h.cnr, h.obj)
|
dst.objectHeaders = addressHeaders(c.cnr, c.obj)
|
||||||
case *objectV2.PutRequest:
|
case *objectV2.PutRequest:
|
||||||
if v, ok := req.GetBody().GetObjectPart().(*objectV2.PutObjectPartInit); ok {
|
if v, ok := req.GetBody().GetObjectPart().(*objectV2.PutObjectPartInit); ok {
|
||||||
oV2 := new(objectV2.Object)
|
oV2 := new(objectV2.Object)
|
||||||
oV2.SetObjectID(v.GetObjectID())
|
oV2.SetObjectID(v.GetObjectID())
|
||||||
oV2.SetHeader(v.GetHeader())
|
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:
|
case *objectV2.SearchRequest:
|
||||||
cnrV2 := req.GetBody().GetContainerID()
|
cnrV2 := req.GetBody().GetContainerID()
|
||||||
|
@ -151,7 +151,7 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error {
|
||||||
case responseXHeaderSource:
|
case responseXHeaderSource:
|
||||||
switch resp := m.resp.(type) {
|
switch resp := m.resp.(type) {
|
||||||
default:
|
default:
|
||||||
objectHeaders, completed := h.localObjectHeaders(h.cnr, h.obj)
|
objectHeaders, completed := c.localObjectHeaders(c.cnr, c.obj)
|
||||||
|
|
||||||
dst.objectHeaders = objectHeaders
|
dst.objectHeaders = objectHeaders
|
||||||
dst.incompleteObjectHeaders = !completed
|
dst.incompleteObjectHeaders = !completed
|
||||||
|
@ -161,7 +161,7 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error {
|
||||||
oV2.SetObjectID(v.GetObjectID())
|
oV2.SetObjectID(v.GetObjectID())
|
||||||
oV2.SetHeader(v.GetHeader())
|
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:
|
case *objectV2.HeadResponse:
|
||||||
oV2 := new(objectV2.Object)
|
oV2 := new(objectV2.Object)
|
||||||
|
@ -173,7 +173,7 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error {
|
||||||
hdr = new(objectV2.Header)
|
hdr = new(objectV2.Header)
|
||||||
|
|
||||||
var idV2 refsV2.ContainerID
|
var idV2 refsV2.ContainerID
|
||||||
h.cnr.WriteToV2(&idV2)
|
c.cnr.WriteToV2(&idV2)
|
||||||
|
|
||||||
hdr.SetContainerID(&idV2)
|
hdr.SetContainerID(&idV2)
|
||||||
hdr.SetVersion(v.GetVersion())
|
hdr.SetVersion(v.GetVersion())
|
||||||
|
@ -187,20 +187,20 @@ func (h *cfg) readObjectHeaders(dst *headerSource) error {
|
||||||
|
|
||||||
oV2.SetHeader(hdr)
|
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
|
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 {
|
if idObj != nil {
|
||||||
var addr oid.Address
|
var addr oid.Address
|
||||||
addr.SetContainer(cnr)
|
addr.SetContainer(cnr)
|
||||||
addr.SetObject(*idObj)
|
addr.SetObject(*idObj)
|
||||||
|
|
||||||
obj, err := h.storage.Head(addr)
|
obj, err := c.storage.Head(addr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return headersFromObject(obj, cnr, idObj), true
|
return headersFromObject(obj, cnr, idObj), true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue