[#452] Update neo-go to latest master

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-04-05 12:27:58 +03:00 committed by Alex Vanin
parent b18da34b55
commit 7cf48d4d91
7 changed files with 52 additions and 2 deletions

View file

@ -180,7 +180,7 @@ func (s *loggingReputationServer) SendLocalTrust(_ context.Context, req *v2reput
for _, t := range body.GetTrusts() { for _, t := range body.GetTrusts() {
log.Info("local trust received", log.Info("local trust received",
zap.String("peer", hex.EncodeToString(t.GetPeer())), zap.String("peer", hex.EncodeToString(t.GetPeer().GetValue())),
zap.Float64("value", t.GetValue()), zap.Float64("value", t.GetValue()),
) )
} }
@ -190,3 +190,11 @@ func (s *loggingReputationServer) SendLocalTrust(_ context.Context, req *v2reput
return resp, nil return resp, nil
} }
func (s *loggingReputationServer) SendIntermediateResult(_ context.Context, req *v2reputation.SendIntermediateResultRequest) (*v2reputation.SendIntermediateResultResponse, error) {
resp := new(v2reputation.SendIntermediateResultResponse)
// todo: implement me
return resp, nil
}

2
go.mod
View file

@ -16,7 +16,7 @@ require (
github.com/multiformats/go-multihash v0.0.13 // indirect github.com/multiformats/go-multihash v0.0.13 // indirect
github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/hrw v1.0.9
github.com/nspcc-dev/neo-go v0.94.0 github.com/nspcc-dev/neo-go v0.94.0
github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210325082034-b792e4e4647a github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210402125759-771f395d9d4e
github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/neofs-crypto v0.3.0
github.com/nspcc-dev/tzhash v1.4.0 github.com/nspcc-dev/tzhash v1.4.0
github.com/panjf2000/ants/v2 v2.3.0 github.com/panjf2000/ants/v2 v2.3.0

BIN
go.sum

Binary file not shown.

View file

@ -35,3 +35,18 @@ func (s *Server) SendLocalTrust(ctx context.Context, r *reputation2.SendLocalTru
return resp.ToGRPCMessage().(*reputation2.SendLocalTrustResponse), nil return resp.ToGRPCMessage().(*reputation2.SendLocalTrustResponse), nil
} }
func (s *Server) SendIntermediateResult(ctx context.Context, r *reputation2.SendIntermediateResultRequest) (*reputation2.SendIntermediateResultResponse, error) {
req := new(reputation.SendIntermediateResultRequest)
if err := req.FromGRPCMessage(r); err != nil {
return nil, err
}
resp, err := s.srv.SendIntermediateResult(ctx, req)
if err != nil {
// TODO: think about how we transport errors through gRPC
return nil, err
}
return resp.ToGRPCMessage().(*reputation2.SendIntermediateResultResponse), nil
}

View file

@ -35,3 +35,16 @@ func (s *responseService) SendLocalTrust(ctx context.Context, req *reputation.Se
return resp.(*reputation.SendLocalTrustResponse), nil return resp.(*reputation.SendLocalTrustResponse), nil
} }
func (s *responseService) SendIntermediateResult(ctx context.Context, req *reputation.SendIntermediateResultRequest) (*reputation.SendIntermediateResultResponse, 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))
},
)
if err != nil {
return nil, err
}
return resp.(*reputation.SendIntermediateResultResponse), nil
}

View file

@ -9,4 +9,5 @@ import (
// Server is an interface of the NeoFS API v2 Reputation service server. // Server is an interface of the NeoFS API v2 Reputation service server.
type Server interface { type Server interface {
SendLocalTrust(context.Context, *reputation.SendLocalTrustRequest) (*reputation.SendLocalTrustResponse, error) SendLocalTrust(context.Context, *reputation.SendLocalTrustRequest) (*reputation.SendLocalTrustResponse, error)
SendIntermediateResult(context.Context, *reputation.SendIntermediateResultRequest) (*reputation.SendIntermediateResultResponse, error)
} }

View file

@ -33,3 +33,16 @@ func (s *signService) SendLocalTrust(ctx context.Context, req *reputation.SendLo
return resp.(*reputation.SendLocalTrustResponse), nil return resp.(*reputation.SendLocalTrustResponse), nil
} }
func (s *signService) SendIntermediateResult(ctx context.Context, req *reputation.SendIntermediateResultRequest) (*reputation.SendIntermediateResultResponse, 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))
},
)
if err != nil {
return nil, err
}
return resp.(*reputation.SendIntermediateResultResponse), nil
}