[#1735] go.mod: Update API and SDK

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-08-29 11:57:02 +03:00 committed by fyrchik
parent 78bf17c0b0
commit 180e5e938f
5 changed files with 41 additions and 44 deletions

View file

@ -330,25 +330,25 @@ func (x PutObjectRes) ID() oid.ID {
func PutObject(prm PutObjectPrm) (*PutObjectRes, error) { func PutObject(prm PutObjectPrm) (*PutObjectRes, error) {
var putPrm client.PrmObjectPutInit 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) wrt, err := prm.cli.ObjectPutInit(context.Background(), putPrm)
if err != nil { if err != nil {
return nil, fmt.Errorf("init object writing: %w", err) 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 wrt.WriteHeader(*prm.hdr) {
if prm.headerCallback != nil { if prm.headerCallback != nil {
prm.headerCallback(prm.hdr) prm.headerCallback(prm.hdr)

4
go.mod
View file

@ -17,9 +17,9 @@ require (
github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/hrw v1.0.9
github.com/nspcc-dev/neo-go v0.99.2 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/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-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/nspcc-dev/tzhash v1.6.1
github.com/panjf2000/ants/v2 v2.4.0 github.com/panjf2000/ants/v2 v2.4.0
github.com/paulmach/orb v0.2.2 github.com/paulmach/orb v0.2.2

BIN
go.sum

Binary file not shown.

View file

@ -64,14 +64,13 @@ func (x Client) SearchSG(prm SearchSGPrm) (*SearchSGRes, error) {
var cliPrm client.PrmObjectSearch var cliPrm client.PrmObjectSearch
cliPrm.InContainer(prm.cnrID) cliPrm.InContainer(prm.cnrID)
cliPrm.SetFilters(sgFilter) cliPrm.SetFilters(sgFilter)
cliPrm.UseKey(*x.key)
rdr, err := x.c.ObjectSearchInit(prm.ctx, cliPrm) rdr, err := x.c.ObjectSearchInit(prm.ctx, cliPrm)
if err != nil { if err != nil {
return nil, fmt.Errorf("init object search: %w", err) return nil, fmt.Errorf("init object search: %w", err)
} }
rdr.UseKey(*x.key)
buf := make([]oid.ID, 10) buf := make([]oid.ID, 10)
var list []oid.ID var list []oid.ID
var n int var n int
@ -124,14 +123,13 @@ func (x Client) GetObject(prm GetObjectPrm) (*GetObjectRes, error) {
var cliPrm client.PrmObjectGet var cliPrm client.PrmObjectGet
cliPrm.FromContainer(prm.objAddr.Container()) cliPrm.FromContainer(prm.objAddr.Container())
cliPrm.ByID(prm.objAddr.Object()) cliPrm.ByID(prm.objAddr.Object())
cliPrm.UseKey(*x.key)
rdr, err := x.c.ObjectGetInit(prm.ctx, cliPrm) rdr, err := x.c.ObjectGetInit(prm.ctx, cliPrm)
if err != nil { if err != nil {
return nil, fmt.Errorf("init object search: %w", err) return nil, fmt.Errorf("init object search: %w", err)
} }
rdr.UseKey(*x.key)
var obj object.Object var obj object.Object
if !rdr.ReadHeader(&obj) { if !rdr.ReadHeader(&obj) {

View file

@ -145,16 +145,15 @@ func GetObject(prm GetObjectPrm) (*GetObjectRes, error) {
} }
prm.cliPrm.WithXHeaders(prm.xHeaders...) prm.cliPrm.WithXHeaders(prm.xHeaders...)
if prm.key != nil {
prm.cliPrm.UseKey(*prm.key)
}
rdr, err := prm.cli.ObjectGetInit(prm.ctx, prm.cliPrm) rdr, err := prm.cli.ObjectGetInit(prm.ctx, prm.cliPrm)
if err != nil { if err != nil {
return nil, fmt.Errorf("init object reading: %w", err) return nil, fmt.Errorf("init object reading: %w", err)
} }
if prm.key != nil {
rdr.UseKey(*prm.key)
}
var obj object.Object var obj object.Object
if !rdr.ReadHeader(&obj) { if !rdr.ReadHeader(&obj) {
@ -374,27 +373,27 @@ func (x PutObjectRes) ID() oid.ID {
func PutObject(prm PutObjectPrm) (*PutObjectRes, error) { func PutObject(prm PutObjectPrm) (*PutObjectRes, error) {
var prmCli client.PrmObjectPutInit 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) w, err := prm.cli.ObjectPutInit(prm.ctx, prmCli)
if err != nil { if err != nil {
return nil, fmt.Errorf("init object writing on client: %w", err) 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) { if w.WriteHeader(*prm.obj) {
w.WritePayloadChunk(prm.obj.Payload()) w.WritePayloadChunk(prm.obj.Payload())
} }
@ -460,15 +459,15 @@ func SearchObjects(prm SearchObjectsPrm) (*SearchObjectsRes, error) {
prm.cliPrm.WithXHeaders(prm.xHeaders...) prm.cliPrm.WithXHeaders(prm.xHeaders...)
if prm.key != nil {
prm.cliPrm.UseKey(*prm.key)
}
rdr, err := prm.cli.ObjectSearchInit(prm.ctx, prm.cliPrm) rdr, err := prm.cli.ObjectSearchInit(prm.ctx, prm.cliPrm)
if err != nil { if err != nil {
return nil, fmt.Errorf("init object searching in client: %w", err) return nil, fmt.Errorf("init object searching in client: %w", err)
} }
if prm.key != nil {
rdr.UseKey(*prm.key)
}
buf := make([]oid.ID, 10) buf := make([]oid.ID, 10)
var ids []oid.ID var ids []oid.ID
var n int var n int