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 | 8 ++-- pkg/innerring/internal/client/client.go | 6 +-- pkg/services/object/internal/client/client.go | 47 +++++++++---------- 5 files changed, 45 insertions(+), 48 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 8a0f28421..cd30969ef 100644 --- a/go.sum +++ b/go.sum @@ -454,8 +454,8 @@ github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220809123759-3094d3e0c14b h1:J7 github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220809123759-3094d3e0c14b/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s= github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= -github.com/nspcc-dev/neofs-api-go/v2 v2.13.2-0.20220818094951-98db3fa28419 h1:NFj8D0UYfHzvC+gIhK7yIUOyEcZi21caQsuYVbJGrVU= -github.com/nspcc-dev/neofs-api-go/v2 v2.13.2-0.20220818094951-98db3fa28419/go.mod h1:NAaDfOnFWIbAFkTj7pNQ+cknVue0JbdeRT9QQaeBCEY= +github.com/nspcc-dev/neofs-api-go/v2 v2.13.2-0.20220827080658-9e17cdfc7647 h1:00JDCprdZG15n8z58EaFvJlmvZ4uESUii8MSzk869JM= +github.com/nspcc-dev/neofs-api-go/v2 v2.13.2-0.20220827080658-9e17cdfc7647/go.mod h1:NAaDfOnFWIbAFkTj7pNQ+cknVue0JbdeRT9QQaeBCEY= github.com/nspcc-dev/neofs-contract v0.15.3/go.mod h1:BXVZUZUJxrmmDETglXHI8+5DSgn84B9y5DoSWqEjYCs= github.com/nspcc-dev/neofs-contract v0.15.5 h1:6Fsr1VRaG1klCWipWWPHvVkKaVS85tcxxsNDbvVB2zk= github.com/nspcc-dev/neofs-contract v0.15.5/go.mod h1:gN5bo2TlMvLbySImmg76DVj3jVmYgti2VVlQ+h/tcr0= @@ -466,8 +466,8 @@ github.com/nspcc-dev/neofs-crypto v0.4.0 h1:5LlrUAM5O0k1+sH/sktBtrgfWtq1pgpDs09f github.com/nspcc-dev/neofs-crypto v0.4.0/go.mod h1:6XJ8kbXgOfevbI2WMruOtI+qUJXNwSGM/E9eClXxPHs= github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211201182451-a5b61c4f6477/go.mod h1:dfMtQWmBHYpl9Dez23TGtIUKiFvCIxUZq/CkSIhEpz4= github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220113123743-7f3162110659/go.mod h1:/jay1lr3w7NQd/VDBkEhkJmDmyPNsu4W+QV2obsUV40= -github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.6.0.20220824140410-7537fa0decc5 h1:BkjgenUQeXnMnbvdpyn8tOoxZmaeKOsN6EEq8wF9Xnw= -github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.6.0.20220824140410-7537fa0decc5/go.mod h1:BQPxy2sOURSegZJVnrwYDagPtKI3H1Ctc7e0yS0xHvk= +github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.6.0.20220829114550-ee92df32032e h1:4bw+na7QGjEHnZeNGhW31+l/MQ6N5NZ1LxCbldY0Rgo= +github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.6.0.20220829114550-ee92df32032e/go.mod h1:zANAq4ZCA1YFX+DSzP/ydBv/Krj5sdkK5orpTISmZR4= github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= 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