forked from TrueCloudLab/frostfs-node
[#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:
parent
9e08b41a6f
commit
e6f04f7785
7 changed files with 19 additions and 11 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/nspcc-dev/neofs-node/pkg/innerring/invoke"
|
||||
netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// Process add peer notification by sanity check of new node
|
||||
|
@ -20,7 +21,7 @@ func (np *Processor) processAddPeer(node []byte) {
|
|||
// unmarshal grpc (any transport) version of node info from API v2
|
||||
nodeInfo := new(netmap.NodeInfo)
|
||||
|
||||
err := nodeInfo.Unmarshal(node)
|
||||
err := proto.Unmarshal(node, nodeInfo)
|
||||
if err != nil {
|
||||
// it will be nice to have tx id at event structure to log it
|
||||
np.log.Warn("can't parse network map candidate")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue