From 180e5e938f55a54393c84404f6ea2a9ce1dd270c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 29 Aug 2022 11:57:02 +0300 Subject: [PATCH] [#1735] go.mod: Update API and SDK Signed-off-by: Evgenii Stratonikov --- cmd/neofs-cli/internal/client/client.go | 28 +++++------ go.mod | 4 +- go.sum | Bin 116790 -> 116790 bytes pkg/innerring/internal/client/client.go | 6 +-- pkg/services/object/internal/client/client.go | 47 +++++++++--------- 5 files changed, 41 insertions(+), 44 deletions(-) diff --git a/cmd/neofs-cli/internal/client/client.go b/cmd/neofs-cli/internal/client/client.go index d64903b68..5178d968c 100644 --- a/cmd/neofs-cli/internal/client/client.go +++ b/cmd/neofs-cli/internal/client/client.go @@ -330,25 +330,25 @@ func (x PutObjectRes) ID() oid.ID { func PutObject(prm PutObjectPrm) (*PutObjectRes, error) { var putPrm client.PrmObjectPutInit + if prm.sessionToken != nil { + putPrm.WithinSession(*prm.sessionToken) + } + + if prm.bearerToken != nil { + putPrm.WithBearerToken(*prm.bearerToken) + } + + if prm.local { + putPrm.MarkLocal() + } + + putPrm.WithXHeaders(prm.xHeaders...) + wrt, err := prm.cli.ObjectPutInit(context.Background(), putPrm) if err != nil { return nil, fmt.Errorf("init object writing: %w", err) } - if prm.sessionToken != nil { - wrt.WithinSession(*prm.sessionToken) - } - - if prm.bearerToken != nil { - wrt.WithBearerToken(*prm.bearerToken) - } - - if prm.local { - wrt.MarkLocal() - } - - wrt.WithXHeaders(prm.xHeaders...) - if wrt.WriteHeader(*prm.hdr) { if prm.headerCallback != nil { prm.headerCallback(prm.hdr) diff --git a/go.mod b/go.mod index 95244ecc0..fd755252e 100644 --- a/go.mod +++ b/go.mod @@ -17,9 +17,9 @@ require ( github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.99.2 github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220809123759-3094d3e0c14b // indirect - github.com/nspcc-dev/neofs-api-go/v2 v2.13.2-0.20220818094951-98db3fa28419 + github.com/nspcc-dev/neofs-api-go/v2 v2.13.2-0.20220827080658-9e17cdfc7647 github.com/nspcc-dev/neofs-contract v0.15.5 - github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.6.0.20220824140410-7537fa0decc5 + github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.6.0.20220829114550-ee92df32032e github.com/nspcc-dev/tzhash v1.6.1 github.com/panjf2000/ants/v2 v2.4.0 github.com/paulmach/orb v0.2.2 diff --git a/go.sum b/go.sum index 8a0f28421aab286d41d75b6379f339cc9c83067e..cd30969ef738e4830d7c152a445e56c9a4b31e9b 100644 GIT binary patch delta 293 zcmdlsfqmNq_6>*DxEPrmSQwa@TIgD)8k#4kq$Qi1nV2hN7+M(^c)2(i6s1JD8=B@> zRGC`1Cc2e*<>Zz{nUuN)hh}D4_y$*HTbNmT`A%NAT3gXr&q&um&&a^Y$iM=tp__x& zCb2kM8XB6Ini}Y)rdk@Mq!}9-7#pR6tTRa}*Un2c4|LCR^~j4#^>fb%H#XGH(f18B z^E35}GW4l%PRdD%Gzd!12U;gPdBFyb$qP1$cwsY7KRsVBH$MerY?Y&*W1&fuv!h|8 zTZFbta8-bQWr|aozIRcUX>m%nw`qP+L5OE?Zd8!TWXI*=lN~m5H_zF$eam~ delta 293 zcmdlsfqmNq_6>*DxENX(SejUx8tPhFq$C-qB^p_n7+NZ17+U$cWm&iwghr-$RFyev zr+a32n^$^<`d7LpM`aorCMO0KmqvyqdAS#bg-%|$T3gXr&q&um&&a^Y$iM=tp__x& zCb2l17@8QE7#irBn;M&^B^sopCMTPMtaHlFN>9xT4NQ&5^UX^tODU+#vncV;uZYS` zO!f9J_A_&JEwm_ivy8|q2U;gPdBFyb$qP1$cwsY7KRsVBH$MezY+yh|rBSheXi#u! zdX!gKUQv0ZOJaIJiMOY*hoN&xvU#dOWw1eoM_Kk{$K~Ra9X4|}&)Kwn&L+lLq5v+& BU_$@^ diff --git a/pkg/innerring/internal/client/client.go b/pkg/innerring/internal/client/client.go index fb2d63547..cab9ad3b1 100644 --- a/pkg/innerring/internal/client/client.go +++ b/pkg/innerring/internal/client/client.go @@ -64,14 +64,13 @@ func (x Client) SearchSG(prm SearchSGPrm) (*SearchSGRes, error) { var cliPrm client.PrmObjectSearch cliPrm.InContainer(prm.cnrID) cliPrm.SetFilters(sgFilter) + cliPrm.UseKey(*x.key) rdr, err := x.c.ObjectSearchInit(prm.ctx, cliPrm) if err != nil { return nil, fmt.Errorf("init object search: %w", err) } - rdr.UseKey(*x.key) - buf := make([]oid.ID, 10) var list []oid.ID var n int @@ -124,14 +123,13 @@ func (x Client) GetObject(prm GetObjectPrm) (*GetObjectRes, error) { var cliPrm client.PrmObjectGet cliPrm.FromContainer(prm.objAddr.Container()) cliPrm.ByID(prm.objAddr.Object()) + cliPrm.UseKey(*x.key) rdr, err := x.c.ObjectGetInit(prm.ctx, cliPrm) if err != nil { return nil, fmt.Errorf("init object search: %w", err) } - rdr.UseKey(*x.key) - var obj object.Object if !rdr.ReadHeader(&obj) { diff --git a/pkg/services/object/internal/client/client.go b/pkg/services/object/internal/client/client.go index f7cd14de5..cd01ed044 100644 --- a/pkg/services/object/internal/client/client.go +++ b/pkg/services/object/internal/client/client.go @@ -145,16 +145,15 @@ func GetObject(prm GetObjectPrm) (*GetObjectRes, error) { } prm.cliPrm.WithXHeaders(prm.xHeaders...) + if prm.key != nil { + prm.cliPrm.UseKey(*prm.key) + } rdr, err := prm.cli.ObjectGetInit(prm.ctx, prm.cliPrm) if err != nil { return nil, fmt.Errorf("init object reading: %w", err) } - if prm.key != nil { - rdr.UseKey(*prm.key) - } - var obj object.Object if !rdr.ReadHeader(&obj) { @@ -374,27 +373,27 @@ func (x PutObjectRes) ID() oid.ID { func PutObject(prm PutObjectPrm) (*PutObjectRes, error) { var prmCli client.PrmObjectPutInit + prmCli.MarkLocal() + + if prm.key != nil { + prmCli.UseKey(*prm.key) + } + + if prm.tokenSession != nil { + prmCli.WithinSession(*prm.tokenSession) + } + + if prm.tokenBearer != nil { + prmCli.WithBearerToken(*prm.tokenBearer) + } + + prmCli.WithXHeaders(prm.xHeaders...) + w, err := prm.cli.ObjectPutInit(prm.ctx, prmCli) if err != nil { return nil, fmt.Errorf("init object writing on client: %w", err) } - w.MarkLocal() - - if prm.key != nil { - w.UseKey(*prm.key) - } - - if prm.tokenSession != nil { - w.WithinSession(*prm.tokenSession) - } - - if prm.tokenBearer != nil { - w.WithBearerToken(*prm.tokenBearer) - } - - w.WithXHeaders(prm.xHeaders...) - if w.WriteHeader(*prm.obj) { w.WritePayloadChunk(prm.obj.Payload()) } @@ -460,15 +459,15 @@ func SearchObjects(prm SearchObjectsPrm) (*SearchObjectsRes, error) { prm.cliPrm.WithXHeaders(prm.xHeaders...) + if prm.key != nil { + prm.cliPrm.UseKey(*prm.key) + } + rdr, err := prm.cli.ObjectSearchInit(prm.ctx, prm.cliPrm) if err != nil { return nil, fmt.Errorf("init object searching in client: %w", err) } - if prm.key != nil { - rdr.UseKey(*prm.key) - } - buf := make([]oid.ID, 10) var ids []oid.ID var n int