forked from TrueCloudLab/frostfs-node
[#1735] go.mod: Update API and SDK
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
78bf17c0b0
commit
180e5e938f
5 changed files with 45 additions and 48 deletions
|
@ -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
4
go.mod
|
@ -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
|
||||||
|
|
8
go.sum
8
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/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.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.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.20220827080658-9e17cdfc7647 h1:00JDCprdZG15n8z58EaFvJlmvZ4uESUii8MSzk869JM=
|
||||||
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/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.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 h1:6Fsr1VRaG1klCWipWWPHvVkKaVS85tcxxsNDbvVB2zk=
|
||||||
github.com/nspcc-dev/neofs-contract v0.15.5/go.mod h1:gN5bo2TlMvLbySImmg76DVj3jVmYgti2VVlQ+h/tcr0=
|
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-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-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 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.20220829114550-ee92df32032e h1:4bw+na7QGjEHnZeNGhW31+l/MQ6N5NZ1LxCbldY0Rgo=
|
||||||
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/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.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 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE=
|
||||||
github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso=
|
github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso=
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue