From d49bd4b94a3fa2824afaa076756d217935df4fc0 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 7 May 2021 14:13:11 +0300 Subject: [PATCH] Update neofs-api-go to v1.26.0 Signed-off-by: Alex Vanin --- cmd/neofs-node/reputation.go | 16 ++++++++-------- cmd/neofs-node/reputation/intermediate/remote.go | 6 +++--- cmd/neofs-node/reputation/local/remote.go | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- pkg/innerring/processors/reputation/handlers.go | 2 +- .../processors/reputation/process_put.go | 2 +- pkg/morph/client/reputation/wrapper/get.go | 2 +- pkg/morph/client/reputation/wrapper/put.go | 2 +- pkg/network/transport/reputation/grpc/service.go | 16 ++++++++-------- pkg/services/reputation/rpc/response.go | 12 ++++++------ pkg/services/reputation/rpc/server.go | 4 ++-- pkg/services/reputation/rpc/sign.go | 12 ++++++------ 13 files changed, 42 insertions(+), 42 deletions(-) diff --git a/cmd/neofs-node/reputation.go b/cmd/neofs-node/reputation.go index 880fc0d57..4119802c5 100644 --- a/cmd/neofs-node/reputation.go +++ b/cmd/neofs-node/reputation.go @@ -259,7 +259,7 @@ type reputationServer struct { routeBuilder reputationrouter.Builder } -func (s *reputationServer) SendLocalTrust(ctx context.Context, req *v2reputation.SendLocalTrustRequest) (*v2reputation.SendLocalTrustResponse, error) { +func (s *reputationServer) AnnounceLocalTrust(ctx context.Context, req *v2reputation.AnnounceLocalTrustRequest) (*v2reputation.AnnounceLocalTrustResponse, error) { passedRoute := reverseRoute(req.GetVerificationHeader()) passedRoute = append(passedRoute, s) @@ -282,13 +282,13 @@ func (s *reputationServer) SendLocalTrust(ctx context.Context, req *v2reputation } } - resp := new(v2reputation.SendLocalTrustResponse) - resp.SetBody(new(v2reputation.SendLocalTrustResponseBody)) + resp := new(v2reputation.AnnounceLocalTrustResponse) + resp.SetBody(new(v2reputation.AnnounceLocalTrustResponseBody)) return resp, nil } -func (s *reputationServer) SendIntermediateResult(ctx context.Context, req *v2reputation.SendIntermediateResultRequest) (*v2reputation.SendIntermediateResultResponse, error) { +func (s *reputationServer) AnnounceIntermediateResult(ctx context.Context, req *v2reputation.AnnounceIntermediateResultRequest) (*v2reputation.AnnounceIntermediateResultResponse, error) { passedRoute := reverseRoute(req.GetVerificationHeader()) passedRoute = append(passedRoute, s) @@ -303,15 +303,15 @@ func (s *reputationServer) SendIntermediateResult(ctx context.Context, req *v2re v2Trust := body.GetTrust() - trust := apiToLocalTrust(v2Trust.GetTrust(), v2Trust.GetTrustingPeer().GetValue()) + trust := apiToLocalTrust(v2Trust.GetTrust(), v2Trust.GetTrustingPeer().GetPublicKey()) err = w.Write(trust) if err != nil { return nil, errors.Wrap(err, "could not write intermediate trust") } - resp := new(v2reputation.SendIntermediateResultResponse) - resp.SetBody(new(v2reputation.SendIntermediateResultResponseBody)) + resp := new(v2reputation.AnnounceIntermediateResultResponse) + resp.SetBody(new(v2reputation.AnnounceIntermediateResultResponseBody)) return resp, nil } @@ -331,7 +331,7 @@ func apiToLocalTrust(t *v2reputation.Trust, trustingPeer []byte) reputation.Trus localTrust := reputation.Trust{} localTrust.SetValue(reputation.TrustValueFromFloat64(t.GetValue())) - localTrust.SetPeer(reputation.PeerIDFromBytes(t.GetPeer().GetValue())) + localTrust.SetPeer(reputation.PeerIDFromBytes(t.GetPeer().GetPublicKey())) localTrust.SetTrustingPeer(reputation.PeerIDFromBytes(trustingPeer)) return localTrust diff --git a/cmd/neofs-node/reputation/intermediate/remote.go b/cmd/neofs-node/reputation/intermediate/remote.go index c353738ce..ca8283d01 100644 --- a/cmd/neofs-node/reputation/intermediate/remote.go +++ b/cmd/neofs-node/reputation/intermediate/remote.go @@ -73,7 +73,7 @@ type RemoteTrustWriter struct { client apiClient.Client key *ecdsa.PrivateKey - buf []*apiClient.SendIntermediateTrustPrm + buf []*apiClient.AnnounceIntermediateTrustPrm } // Write check if passed context contains required @@ -94,7 +94,7 @@ func (rtp *RemoteTrustWriter) Write(t reputation.Trust) error { apiPeerToPeerTrust.SetTrustingPeer(apiTrustingPeer) apiPeerToPeerTrust.SetTrust(apiTrust) - p := &apiClient.SendIntermediateTrustPrm{} + p := &apiClient.AnnounceIntermediateTrustPrm{} p.SetEpoch(rtp.eiCtx.Epoch()) p.SetIteration(rtp.eiCtx.I()) p.SetTrust(apiPeerToPeerTrust) @@ -108,7 +108,7 @@ func (rtp *RemoteTrustWriter) Write(t reputation.Trust) error { // If error occurs, returns in immediately and stops iteration. func (rtp *RemoteTrustWriter) Close() (err error) { for _, prm := range rtp.buf { - _, err = rtp.client.SendIntermediateTrust( + _, err = rtp.client.AnnounceIntermediateTrust( rtp.eiCtx, *prm, apiClient.WithKey(rtp.key), diff --git a/cmd/neofs-node/reputation/local/remote.go b/cmd/neofs-node/reputation/local/remote.go index 3b63c988f..6d5df183a 100644 --- a/cmd/neofs-node/reputation/local/remote.go +++ b/cmd/neofs-node/reputation/local/remote.go @@ -84,12 +84,12 @@ func (rtp *RemoteTrustWriter) Write(t reputation.Trust) error { } func (rtp *RemoteTrustWriter) Close() error { - prm := apiClient.SendLocalTrustPrm{} + prm := apiClient.AnnounceLocalTrustPrm{} prm.SetEpoch(rtp.ctx.Epoch()) prm.SetTrusts(rtp.buf) - _, err := rtp.client.SendLocalTrust( + _, err := rtp.client.AnnounceLocalTrust( rtp.ctx, prm, apiClient.WithKey(rtp.key), diff --git a/go.mod b/go.mod index abfb423c2..106a1f43d 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/multiformats/go-multihash v0.0.13 // indirect github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.94.1 - github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210427074637-bb217067f442 + github.com/nspcc-dev/neofs-api-go v1.26.0 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.3.0 diff --git a/go.sum b/go.sum index b0903f62f..f601bfccc 100644 --- a/go.sum +++ b/go.sum @@ -276,8 +276,8 @@ github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5 github.com/nspcc-dev/neo-go v0.94.1 h1:AHUnADrzJ3JW2wO8xSp9dH8/Lo5UwTojkpuNqHuulSw= github.com/nspcc-dev/neo-go v0.94.1/go.mod h1:IrBT/UG3/Slhqgjge8r6zni5tNRsWmwwG9OnVdASheI= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= -github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210427074637-bb217067f442 h1:XkGER1DMdHK3eFk+bGev/M/U7YQS30NskBvOOaO/Mzw= -github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210427074637-bb217067f442/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= +github.com/nspcc-dev/neofs-api-go v1.26.0 h1:kaQwCspb5k6xbxHBaEqh+0U5OUN0yowKP/QcPRQjCb0= +github.com/nspcc-dev/neofs-api-go v1.26.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= 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= diff --git a/pkg/innerring/processors/reputation/handlers.go b/pkg/innerring/processors/reputation/handlers.go index d5383a487..4d3c8ab81 100644 --- a/pkg/innerring/processors/reputation/handlers.go +++ b/pkg/innerring/processors/reputation/handlers.go @@ -14,7 +14,7 @@ func (rp *Processor) handlePutReputation(ev event.Event) { rp.log.Info("notification", zap.String("type", "reputation put"), - zap.String("peer_id", hex.EncodeToString(peerID.ToV2().GetValue()))) + zap.String("peer_id", hex.EncodeToString(peerID.ToV2().GetPublicKey()))) // send event to the worker pool diff --git a/pkg/innerring/processors/reputation/process_put.go b/pkg/innerring/processors/reputation/process_put.go index c346fa7cd..4c9ac7cf2 100644 --- a/pkg/innerring/processors/reputation/process_put.go +++ b/pkg/innerring/processors/reputation/process_put.go @@ -51,7 +51,7 @@ func (rp *Processor) processPut(epoch uint64, id reputation.PeerID, value reputa if err != nil { rp.log.Warn("can't send approval tx for reputation value", - zap.String("peer_id", hex.EncodeToString(id.ToV2().GetValue())), + zap.String("peer_id", hex.EncodeToString(id.ToV2().GetPublicKey())), zap.String("error", err.Error())) } } diff --git a/pkg/morph/client/reputation/wrapper/get.go b/pkg/morph/client/reputation/wrapper/get.go index 2d3d1b3ad..06cdc338f 100644 --- a/pkg/morph/client/reputation/wrapper/get.go +++ b/pkg/morph/client/reputation/wrapper/get.go @@ -50,7 +50,7 @@ func (g GetResult) Reputations() []reputation.GlobalTrust { func (w *ClientWrapper) Get(v GetArgs) (*GetResult, error) { args := reputationClient.GetArgs{} args.SetEpoch(v.epoch) - args.SetPeerID(v.peerID.ToV2().GetValue()) + args.SetPeerID(v.peerID.ToV2().GetPublicKey()) data, err := (*reputationClient.Client)(w).Get(args) if err != nil { diff --git a/pkg/morph/client/reputation/wrapper/put.go b/pkg/morph/client/reputation/wrapper/put.go index 91a693cd9..cf79fa4e6 100644 --- a/pkg/morph/client/reputation/wrapper/put.go +++ b/pkg/morph/client/reputation/wrapper/put.go @@ -60,7 +60,7 @@ func preparePutArgs(v PutArgs) (reputationClient.PutArgs, error) { } args.SetEpoch(v.epoch) - args.SetPeerID(v.peerID.ToV2().GetValue()) + args.SetPeerID(v.peerID.ToV2().GetPublicKey()) args.SetValue(data) return args, nil diff --git a/pkg/network/transport/reputation/grpc/service.go b/pkg/network/transport/reputation/grpc/service.go index 8794a565e..5faff787b 100644 --- a/pkg/network/transport/reputation/grpc/service.go +++ b/pkg/network/transport/reputation/grpc/service.go @@ -21,32 +21,32 @@ func New(srv reputationrpc.Server) *Server { } } -func (s *Server) SendLocalTrust(ctx context.Context, r *reputation2.SendLocalTrustRequest) (*reputation2.SendLocalTrustResponse, error) { - req := new(reputation.SendLocalTrustRequest) +func (s *Server) AnnounceLocalTrust(ctx context.Context, r *reputation2.AnnounceLocalTrustRequest) (*reputation2.AnnounceLocalTrustResponse, error) { + req := new(reputation.AnnounceLocalTrustRequest) if err := req.FromGRPCMessage(r); err != nil { return nil, err } - resp, err := s.srv.SendLocalTrust(ctx, req) + resp, err := s.srv.AnnounceLocalTrust(ctx, req) if err != nil { // TODO: think about how we transport errors through gRPC return nil, err } - return resp.ToGRPCMessage().(*reputation2.SendLocalTrustResponse), nil + return resp.ToGRPCMessage().(*reputation2.AnnounceLocalTrustResponse), nil } -func (s *Server) SendIntermediateResult(ctx context.Context, r *reputation2.SendIntermediateResultRequest) (*reputation2.SendIntermediateResultResponse, error) { - req := new(reputation.SendIntermediateResultRequest) +func (s *Server) AnnounceIntermediateResult(ctx context.Context, r *reputation2.AnnounceIntermediateResultRequest) (*reputation2.AnnounceIntermediateResultResponse, error) { + req := new(reputation.AnnounceIntermediateResultRequest) if err := req.FromGRPCMessage(r); err != nil { return nil, err } - resp, err := s.srv.SendIntermediateResult(ctx, req) + resp, err := s.srv.AnnounceIntermediateResult(ctx, req) if err != nil { // TODO: think about how we transport errors through gRPC return nil, err } - return resp.ToGRPCMessage().(*reputation2.SendIntermediateResultResponse), nil + return resp.ToGRPCMessage().(*reputation2.AnnounceIntermediateResultResponse), nil } diff --git a/pkg/services/reputation/rpc/response.go b/pkg/services/reputation/rpc/response.go index 805408371..600c28a24 100644 --- a/pkg/services/reputation/rpc/response.go +++ b/pkg/services/reputation/rpc/response.go @@ -23,28 +23,28 @@ func NewResponseService(cnrSvc Server, respSvc *response.Service) Server { } } -func (s *responseService) SendLocalTrust(ctx context.Context, req *reputation.SendLocalTrustRequest) (*reputation.SendLocalTrustResponse, error) { +func (s *responseService) AnnounceLocalTrust(ctx context.Context, req *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error) { resp, err := s.respSvc.HandleUnaryRequest(ctx, req, func(ctx context.Context, req interface{}) (util.ResponseMessage, error) { - return s.svc.SendLocalTrust(ctx, req.(*reputation.SendLocalTrustRequest)) + return s.svc.AnnounceLocalTrust(ctx, req.(*reputation.AnnounceLocalTrustRequest)) }, ) if err != nil { return nil, err } - return resp.(*reputation.SendLocalTrustResponse), nil + return resp.(*reputation.AnnounceLocalTrustResponse), nil } -func (s *responseService) SendIntermediateResult(ctx context.Context, req *reputation.SendIntermediateResultRequest) (*reputation.SendIntermediateResultResponse, error) { +func (s *responseService) AnnounceIntermediateResult(ctx context.Context, req *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error) { resp, err := s.respSvc.HandleUnaryRequest(ctx, req, func(ctx context.Context, req interface{}) (util.ResponseMessage, error) { - return s.svc.SendIntermediateResult(ctx, req.(*reputation.SendIntermediateResultRequest)) + return s.svc.AnnounceIntermediateResult(ctx, req.(*reputation.AnnounceIntermediateResultRequest)) }, ) if err != nil { return nil, err } - return resp.(*reputation.SendIntermediateResultResponse), nil + return resp.(*reputation.AnnounceIntermediateResultResponse), nil } diff --git a/pkg/services/reputation/rpc/server.go b/pkg/services/reputation/rpc/server.go index 4647453bf..32559f2fe 100644 --- a/pkg/services/reputation/rpc/server.go +++ b/pkg/services/reputation/rpc/server.go @@ -8,6 +8,6 @@ import ( // Server is an interface of the NeoFS API v2 Reputation service server. type Server interface { - SendLocalTrust(context.Context, *reputation.SendLocalTrustRequest) (*reputation.SendLocalTrustResponse, error) - SendIntermediateResult(context.Context, *reputation.SendIntermediateResultRequest) (*reputation.SendIntermediateResultResponse, error) + AnnounceLocalTrust(context.Context, *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error) + AnnounceIntermediateResult(context.Context, *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error) } diff --git a/pkg/services/reputation/rpc/sign.go b/pkg/services/reputation/rpc/sign.go index d44f2a1f0..bbbf946c6 100644 --- a/pkg/services/reputation/rpc/sign.go +++ b/pkg/services/reputation/rpc/sign.go @@ -21,28 +21,28 @@ func NewSignService(key *ecdsa.PrivateKey, svc Server) Server { } } -func (s *signService) SendLocalTrust(ctx context.Context, req *reputation.SendLocalTrustRequest) (*reputation.SendLocalTrustResponse, error) { +func (s *signService) AnnounceLocalTrust(ctx context.Context, req *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error) { resp, err := s.sigSvc.HandleUnaryRequest(ctx, req, func(ctx context.Context, req interface{}) (util.ResponseMessage, error) { - return s.svc.SendLocalTrust(ctx, req.(*reputation.SendLocalTrustRequest)) + return s.svc.AnnounceLocalTrust(ctx, req.(*reputation.AnnounceLocalTrustRequest)) }, ) if err != nil { return nil, err } - return resp.(*reputation.SendLocalTrustResponse), nil + return resp.(*reputation.AnnounceLocalTrustResponse), nil } -func (s *signService) SendIntermediateResult(ctx context.Context, req *reputation.SendIntermediateResultRequest) (*reputation.SendIntermediateResultResponse, error) { +func (s *signService) AnnounceIntermediateResult(ctx context.Context, req *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error) { resp, err := s.sigSvc.HandleUnaryRequest(ctx, req, func(ctx context.Context, req interface{}) (util.ResponseMessage, error) { - return s.svc.SendIntermediateResult(ctx, req.(*reputation.SendIntermediateResultRequest)) + return s.svc.AnnounceIntermediateResult(ctx, req.(*reputation.AnnounceIntermediateResultRequest)) }, ) if err != nil { return nil, err } - return resp.(*reputation.SendIntermediateResultResponse), nil + return resp.(*reputation.AnnounceIntermediateResultResponse), nil }