[#104] Update neofs-api-go with new protobuf API

Also update contains JSON converters for neofs-cli
and fixes bug in container.set-acl command of SDK.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-10-20 13:50:35 +03:00 committed by Alex Vanin
parent 9e08b41a6f
commit e6f04f7785
7 changed files with 19 additions and 11 deletions

View file

@ -11,6 +11,7 @@ import (
core "github.com/nspcc-dev/neofs-node/pkg/core/container"
client "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
)
var (
@ -82,7 +83,7 @@ func (w *Wrapper) Get(cid *container.ID) (*container.Container, error) {
// convert serialized bytes into GRPC structure
grpcMsg := new(msgContainer.Container)
err = grpcMsg.Unmarshal(rpcAnswer.Container())
err = proto.Unmarshal(rpcAnswer.Container(), grpcMsg)
if err != nil {
// use other major version if there any
return nil, errors.Wrap(err, "can't unmarshal container")

View file

@ -7,6 +7,7 @@ import (
msgACL "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc"
client "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
)
// GetEACL reads the extended ACL table from NeoFS system
@ -30,7 +31,7 @@ func (w *Wrapper) GetEACL(cid *container.ID) (*eacl.Table, []byte, error) {
}
grpcMsg := new(msgACL.EACLTable)
err = grpcMsg.Unmarshal(rpcAnswer.EACL())
err = proto.Unmarshal(rpcAnswer.EACL(), grpcMsg)
if err != nil {
// use other major version if there any
return nil, nil, err

View file

@ -6,6 +6,7 @@ import (
grpcNetmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc"
client "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
)
// GetNetMap receives information list about storage nodes
@ -26,7 +27,7 @@ func (w Wrapper) GetNetMap(diff uint64) (*netmap.Netmap, error) {
for _, peer := range rawPeers {
grpcNodeInfo := new(grpcNetmap.NodeInfo) // transport representation of struct
err = grpcNodeInfo.Unmarshal(peer)
err = proto.Unmarshal(peer, grpcNodeInfo)
if err != nil {
// consider unmarshalling into different major versions
// of NodeInfo structure, if there any