forked from TrueCloudLab/frostfs-node
[#30] Update to latest neofs-api-go and fix conflicts
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
84b4ff0755
commit
9c1c023f05
6 changed files with 27 additions and 33 deletions
2
go.mod
2
go.mod
|
@ -13,7 +13,7 @@ require (
|
||||||
github.com/multiformats/go-multiaddr-net v0.1.2 // v0.1.1 => v0.1.2
|
github.com/multiformats/go-multiaddr-net v0.1.2 // v0.1.1 => v0.1.2
|
||||||
github.com/multiformats/go-multihash v0.0.13 // indirect
|
github.com/multiformats/go-multihash v0.0.13 // indirect
|
||||||
github.com/nspcc-dev/neo-go v0.91.1-pre.0.20200827184617-7560aa345a78
|
github.com/nspcc-dev/neo-go v0.91.1-pre.0.20200827184617-7560aa345a78
|
||||||
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200911095622-47fd771ee4c5
|
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200916115135-ff325b877023
|
||||||
github.com/nspcc-dev/neofs-crypto v0.3.0
|
github.com/nspcc-dev/neofs-crypto v0.3.0
|
||||||
github.com/panjf2000/ants/v2 v2.3.0
|
github.com/panjf2000/ants/v2 v2.3.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -271,6 +271,8 @@ github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200902121740-5a6dff8c83ba h1:S8YfqJ
|
||||||
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200902121740-5a6dff8c83ba/go.mod h1:f5Z4UggDgVgZXnDNr2ItdGwBpVYJBKlm5Yyu2XYEiAc=
|
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200902121740-5a6dff8c83ba/go.mod h1:f5Z4UggDgVgZXnDNr2ItdGwBpVYJBKlm5Yyu2XYEiAc=
|
||||||
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200911095622-47fd771ee4c5 h1:+/VTNh3tHfuBHF+Xyf/QVO/U7QTcWyJ0rPHl+b8i0kU=
|
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200911095622-47fd771ee4c5 h1:+/VTNh3tHfuBHF+Xyf/QVO/U7QTcWyJ0rPHl+b8i0kU=
|
||||||
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200911095622-47fd771ee4c5/go.mod h1:FsFd1z4YzoEgPlltsUgnqna9qhcF87RHYjot0pby2L4=
|
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200911095622-47fd771ee4c5/go.mod h1:FsFd1z4YzoEgPlltsUgnqna9qhcF87RHYjot0pby2L4=
|
||||||
|
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200916115135-ff325b877023 h1:tltnqudivH6TBzs4DEouLx9rwPUBuvn7bjm4EZyosUc=
|
||||||
|
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200916115135-ff325b877023/go.mod h1:FsFd1z4YzoEgPlltsUgnqna9qhcF87RHYjot0pby2L4=
|
||||||
github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA=
|
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.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 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM=
|
||||||
|
|
|
@ -19,17 +19,12 @@ func (a *Address) MarshalStableV2() ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddressFromV2 converts v2 Address message to Address.
|
// AddressFromV2 converts v2 Address message to Address.
|
||||||
func AddressFromV2(aV2 *refs.Address) (*Address, error) {
|
func AddressFromV2(aV2 *refs.Address) *Address {
|
||||||
if aV2 == nil {
|
if aV2 == nil {
|
||||||
return nil, nil
|
return nil
|
||||||
}
|
|
||||||
|
|
||||||
a, err := object.AddressFromV2(aV2)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Address{
|
return &Address{
|
||||||
Address: a,
|
Address: object.NewAddressFromV2(aV2),
|
||||||
}, nil
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package object
|
||||||
import (
|
import (
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||||
|
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Object represents the NeoFS object.
|
// Object represents the NeoFS object.
|
||||||
|
@ -17,12 +18,7 @@ type Object struct {
|
||||||
// MarshalStableV2 marshals Object to v2 binary format.
|
// MarshalStableV2 marshals Object to v2 binary format.
|
||||||
func (o *Object) MarshalStableV2() ([]byte, error) {
|
func (o *Object) MarshalStableV2() ([]byte, error) {
|
||||||
if o != nil {
|
if o != nil {
|
||||||
v2, err := o.ToV2(nil) // fixme: remove
|
return o.ToV2().StableMarshal(nil)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return v2.StableMarshal(nil)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -31,8 +27,12 @@ func (o *Object) MarshalStableV2() ([]byte, error) {
|
||||||
// Address returns address of the object.
|
// Address returns address of the object.
|
||||||
func (o *Object) Address() *Address {
|
func (o *Object) Address() *Address {
|
||||||
if o != nil {
|
if o != nil {
|
||||||
|
aV2 := new(refs.Address)
|
||||||
|
aV2.SetObjectID(o.GetID().ToV2())
|
||||||
|
aV2.SetContainerID(o.GetContainerID().ToV2())
|
||||||
|
|
||||||
return &Address{
|
return &Address{
|
||||||
Address: o.Object.Address(),
|
Address: object.NewAddressFromV2(aV2),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,19 +40,14 @@ func (o *Object) Address() *Address {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromV2 converts v2 Object message to Object.
|
// FromV2 converts v2 Object message to Object.
|
||||||
func FromV2(oV2 *objectV2.Object) (*Object, error) {
|
func FromV2(oV2 *objectV2.Object) *Object {
|
||||||
if oV2 == nil {
|
if oV2 == nil {
|
||||||
return nil, nil
|
return nil
|
||||||
}
|
|
||||||
|
|
||||||
o, err := object.FromV2(oV2)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Object{
|
return &Object{
|
||||||
Object: o,
|
Object: object.NewFromV2(oV2),
|
||||||
}, nil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromBytes restores Object from binary format.
|
// FromBytes restores Object from binary format.
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
@ -44,8 +45,14 @@ func metaFromObject(o *object.Object) *ObjectMeta {
|
||||||
// FIXME: remove hard-code
|
// FIXME: remove hard-code
|
||||||
meta := new(ObjectMeta)
|
meta := new(ObjectMeta)
|
||||||
meta.savedAtEpoch = 10
|
meta.savedAtEpoch = 10
|
||||||
|
|
||||||
|
raw := objectSDK.NewRaw()
|
||||||
|
raw.SetContainerID(o.GetContainerID())
|
||||||
|
raw.SetOwnerID(o.GetOwnerID())
|
||||||
|
// TODO: set other meta fields
|
||||||
|
|
||||||
meta.head = &object.Object{
|
meta.head = &object.Object{
|
||||||
Object: o.CutPayload(),
|
Object: raw.Object(),
|
||||||
}
|
}
|
||||||
|
|
||||||
return meta
|
return meta
|
||||||
|
|
|
@ -20,12 +20,7 @@ func NewExecutor(client *wrapper.Wrapper) accountingSvc.ServiceExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *morphExecutor) Balance(ctx context.Context, body *accounting.BalanceRequestBody) (*accounting.BalanceResponseBody, error) {
|
func (s *morphExecutor) Balance(ctx context.Context, body *accounting.BalanceRequestBody) (*accounting.BalanceResponseBody, error) {
|
||||||
id, err := owner.IDFromV2(body.GetOwnerID())
|
amount, err := s.client.BalanceOf(owner.NewIDFromV2(body.GetOwnerID()))
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
amount, err := s.client.BalanceOf(id)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue