forked from TrueCloudLab/frostfs-s3-gw
[#346] Upgrade NeoFS SDK Go to 2nd release candidate v1.0.0
Avoid using the deprecated elements. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ac0ffd6136
commit
20b8e3d249
5 changed files with 27 additions and 27 deletions
|
@ -34,15 +34,15 @@ func newTestObject(id *oid.ID, bkt *data.BucketInfo, name string) *object.Object
|
|||
contentType.SetKey(object.AttributeContentType)
|
||||
contentType.SetValue(defaultTestContentType)
|
||||
|
||||
raw := object.NewRaw()
|
||||
raw.SetID(id)
|
||||
raw.SetOwnerID(bkt.Owner)
|
||||
raw.SetContainerID(bkt.CID)
|
||||
raw.SetPayload(defaultTestPayload)
|
||||
raw.SetAttributes(filename, created, contentType)
|
||||
raw.SetPayloadSize(uint64(defaultTestPayloadLength))
|
||||
obj := object.New()
|
||||
obj.SetID(id)
|
||||
obj.SetOwnerID(bkt.Owner)
|
||||
obj.SetContainerID(bkt.CID)
|
||||
obj.SetPayload(defaultTestPayload)
|
||||
obj.SetAttributes(filename, created, contentType)
|
||||
obj.SetPayloadSize(uint64(defaultTestPayloadLength))
|
||||
|
||||
return raw.Object()
|
||||
return obj
|
||||
}
|
||||
|
||||
func newTestInfo(oid *oid.ID, bkt *data.BucketInfo, name string, isDir bool) *data.ObjectInfo {
|
||||
|
|
|
@ -167,12 +167,12 @@ func (t *testNeoFS) CreateObject(_ context.Context, prm PrmObjectCreate) (*oid.I
|
|||
attrs = append(attrs, a)
|
||||
}
|
||||
|
||||
raw := object.NewRaw()
|
||||
raw.SetContainerID(&prm.Container)
|
||||
raw.SetID(id)
|
||||
raw.SetPayloadSize(prm.PayloadSize)
|
||||
raw.SetAttributes(attrs...)
|
||||
raw.SetCreationEpoch(t.currentEpoch)
|
||||
obj := object.New()
|
||||
obj.SetContainerID(&prm.Container)
|
||||
obj.SetID(id)
|
||||
obj.SetPayloadSize(prm.PayloadSize)
|
||||
obj.SetAttributes(attrs...)
|
||||
obj.SetCreationEpoch(t.currentEpoch)
|
||||
t.currentEpoch++
|
||||
|
||||
if prm.Payload != nil {
|
||||
|
@ -180,12 +180,12 @@ func (t *testNeoFS) CreateObject(_ context.Context, prm PrmObjectCreate) (*oid.I
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
raw.SetPayload(all)
|
||||
obj.SetPayload(all)
|
||||
}
|
||||
|
||||
addr := newAddress(raw.ContainerID(), raw.ID())
|
||||
t.objects[addr.String()] = raw.Object()
|
||||
return raw.ID(), nil
|
||||
addr := newAddress(obj.ContainerID(), obj.ID())
|
||||
t.objects[addr.String()] = obj
|
||||
return obj.ID(), nil
|
||||
}
|
||||
|
||||
func (t *testNeoFS) DeleteObject(_ context.Context, prm PrmObjectDelete) error {
|
||||
|
|
4
go.mod
4
go.mod
|
@ -12,8 +12,8 @@ require (
|
|||
github.com/nats-io/nats-server/v2 v2.7.1 // indirect
|
||||
github.com/nats-io/nats.go v1.13.1-0.20220121202836-972a071d373d
|
||||
github.com/nspcc-dev/neo-go v0.98.0
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.12.0
|
||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.1.0.20220228071935-07817fb4032d
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.2-0.20220302134950-d065453bd0a7
|
||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.2
|
||||
github.com/prometheus/client_golang v1.11.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/spf13/viper v1.7.1
|
||||
|
|
8
go.sum
8
go.sum
|
@ -291,15 +291,15 @@ github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:
|
|||
github.com/nspcc-dev/neo-go v0.98.0 h1:yyW4sgY88/pLf0949qmgfkQXzRKC3CI/WyhqXNnwMd8=
|
||||
github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM=
|
||||
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.12.0 h1:xWqXzorDk9WFMTtWP7cwwlyJDL1X6Z4HT1e5zqkq7xY=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.12.0/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.2-0.20220302134950-d065453bd0a7 h1:hLMvj4K9djzBg+TaeDGQWGuohzXvcThi0r0LSLhhi3M=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.2-0.20220302134950-d065453bd0a7/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
|
||||
github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA=
|
||||
github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw=
|
||||
github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM=
|
||||
github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw=
|
||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211201182451-a5b61c4f6477/go.mod h1:dfMtQWmBHYpl9Dez23TGtIUKiFvCIxUZq/CkSIhEpz4=
|
||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.1.0.20220228071935-07817fb4032d h1:ku9s0XJ2LoWbB6nUjkyP7M8ki2nLOlMIvi4fAocf+iY=
|
||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.1.0.20220228071935-07817fb4032d/go.mod h1:/WV31AQHs6YLTjMgMjMZw8Z3/Q7b6kMjNgJVsRab5AU=
|
||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.2 h1:m+em1eyrYFIGUdzs2asDCJH0GVWH+9rYdjLTO42mxSY=
|
||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.2/go.mod h1:bkVH6yZXH5/F2Sut20SDOlQbveBlaVJ0vOX20tLGnZw=
|
||||
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=
|
||||
|
|
|
@ -298,7 +298,7 @@ func (x *NeoFS) CreateObject(ctx context.Context, prm PrmObjectCreate) (*oid.ID,
|
|||
attrs = append(attrs, a)
|
||||
}
|
||||
|
||||
raw := object.NewRaw()
|
||||
raw := object.New()
|
||||
raw.SetContainerID(&prm.Container)
|
||||
raw.SetOwnerID(&prm.Creator)
|
||||
raw.SetAttributes(attrs...)
|
||||
|
@ -312,7 +312,7 @@ func (x *NeoFS) CreateObject(ctx context.Context, prm PrmObjectCreate) (*oid.ID,
|
|||
callOpt = pool.WithKey(prm.PrivateKey)
|
||||
}
|
||||
|
||||
idObj, err := x.pool.PutObject(ctx, *raw.Object(), prm.Payload, callOpt)
|
||||
idObj, err := x.pool.PutObject(ctx, *raw, prm.Payload, callOpt)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("save object via connection pool: %w", err)
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ func (x *NeoFS) ReadObject(ctx context.Context, prm layer.PrmObjectRead) (*layer
|
|||
return nil, fmt.Errorf("read full object payload: %w", err)
|
||||
}
|
||||
|
||||
object.NewRawFrom(&res.Header).SetPayload(payload)
|
||||
res.Header.SetPayload(payload)
|
||||
|
||||
return &layer.ObjectPart{
|
||||
Head: &res.Header,
|
||||
|
|
Loading…
Reference in a new issue