forked from TrueCloudLab/frostfs-node
[#1377] oid, cid: Upgrade SDK package
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
f65898a354
commit
f15e6e888f
118 changed files with 1455 additions and 886 deletions
|
@ -143,8 +143,10 @@ func (t *distributedTarget) sendObject(node nodeDesc) error {
|
|||
}
|
||||
|
||||
func (t *distributedTarget) iteratePlacement(f func(nodeDesc) error) (*transformer.AccessIdentifiers, error) {
|
||||
id, _ := t.obj.ID()
|
||||
|
||||
traverser, err := placement.NewTraverser(
|
||||
append(t.traversal.opts, placement.ForObject(t.obj.ID()))...,
|
||||
append(t.traversal.opts, placement.ForObject(&id))...,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("(%T) could not create object placement traverser: %w", t, err)
|
||||
|
@ -231,6 +233,8 @@ loop:
|
|||
}
|
||||
}
|
||||
|
||||
id, _ = t.obj.ID()
|
||||
|
||||
return new(transformer.AccessIdentifiers).
|
||||
WithSelfID(t.obj.ID()), nil
|
||||
WithSelfID(&id), nil
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ func (t *localTarget) Close() (*transformer.AccessIdentifiers, error) {
|
|||
return nil, fmt.Errorf("(%T) could not put object to local storage: %w", t, err)
|
||||
}
|
||||
|
||||
id, _ := t.obj.ID()
|
||||
|
||||
return new(transformer.AccessIdentifiers).
|
||||
WithSelfID(t.obj.ID()), nil
|
||||
WithSelfID(&id), nil
|
||||
}
|
||||
|
|
|
@ -122,8 +122,13 @@ func (p *Streamer) preparePrm(prm *PutInitPrm) error {
|
|||
return fmt.Errorf("(%T) could not get latest network map: %w", p, err)
|
||||
}
|
||||
|
||||
idCnr, ok := prm.hdr.ContainerID()
|
||||
if !ok {
|
||||
return errors.New("missing container ID")
|
||||
}
|
||||
|
||||
// get container to store the object
|
||||
cnr, err := p.cnrSrc.Get(prm.hdr.ContainerID())
|
||||
cnr, err := p.cnrSrc.Get(&idCnr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("(%T) could not get container by ID: %w", p, err)
|
||||
}
|
||||
|
@ -132,11 +137,15 @@ func (p *Streamer) preparePrm(prm *PutInitPrm) error {
|
|||
prm.traverseOpts = append(prm.traverseOpts,
|
||||
// set processing container
|
||||
placement.ForContainer(cnr),
|
||||
|
||||
// set identifier of the processing object
|
||||
placement.ForObject(prm.hdr.ID()),
|
||||
)
|
||||
|
||||
if id, ok := prm.hdr.ID(); ok {
|
||||
prm.traverseOpts = append(prm.traverseOpts,
|
||||
// set identifier of the processing object
|
||||
placement.ForObject(&id),
|
||||
)
|
||||
}
|
||||
|
||||
// create placement builder from network map
|
||||
builder := placement.NewNetworkMapBuilder(nm)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package putsvc
|
|||
|
||||
import (
|
||||
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
refsV2 "github.com/nspcc-dev/neofs-api-go/v2/refs"
|
||||
putsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/put"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
|
@ -32,8 +33,11 @@ func toChunkPrm(req *objectV2.PutObjectPartChunk) *putsvc.PutChunkPrm {
|
|||
}
|
||||
|
||||
func fromPutResponse(r *putsvc.PutResponse) *objectV2.PutResponse {
|
||||
var idV2 refsV2.ObjectID
|
||||
r.ObjectID().WriteToV2(&idV2)
|
||||
|
||||
body := new(objectV2.PutResponseBody)
|
||||
body.SetObjectID(r.ObjectID().ToV2())
|
||||
body.SetObjectID(&idV2)
|
||||
|
||||
resp := new(objectV2.PutResponse)
|
||||
resp.SetBody(body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue