forked from TrueCloudLab/frostfs-node
[#50] object/head: Add right child to Head operation result
Head service receives right child of the processing object in some cases. Add right child to Head result in order to use it as needed. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3692f708ca
commit
dd16f568c3
2 changed files with 10 additions and 3 deletions
|
@ -5,9 +5,13 @@ import (
|
|||
)
|
||||
|
||||
type Response struct {
|
||||
hdr *object.Object
|
||||
hdr, rightChild *object.Object
|
||||
}
|
||||
|
||||
func (r *Response) Header() *object.Object {
|
||||
return r.hdr
|
||||
}
|
||||
|
||||
func (r *Response) RightChild() *object.Object {
|
||||
return r.rightChild
|
||||
}
|
||||
|
|
|
@ -77,15 +77,18 @@ func (s *Service) Head(ctx context.Context, prm *Prm) (*Response, error) {
|
|||
addr.SetContainerID(prm.addr.GetContainerID())
|
||||
addr.SetObjectID(rightChildID)
|
||||
|
||||
rightChild, err := s.Head(ctx, new(Prm).WithAddress(addr))
|
||||
r, err = s.Head(ctx, new(Prm).WithAddress(addr))
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "(%T) could not get right child header", s)
|
||||
}
|
||||
|
||||
rightChild := r.Header()
|
||||
|
||||
// TODO: check if received parent has requested address
|
||||
|
||||
return &Response{
|
||||
hdr: object.NewFromSDK(rightChild.Header().GetParent()),
|
||||
hdr: object.NewFromSDK(rightChild.GetParent()),
|
||||
rightChild: rightChild,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue