Skip to content

Commit

Permalink
node: Respond with UNIMPLEMENTED status when RPC is not yet support…
Browse files Browse the repository at this point in the history
…ed (#2752)

node: Respond with `UNIMPLEMENTED` status when RPC is not yet supported
  • Loading branch information
roman-khimov authored Feb 26, 2024
2 parents 9756cc4 + 094a599 commit 0f81d20
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions pkg/network/transport/accounting/grpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// Server wraps NeoFS API Accounting service and
// provides gRPC Accounting service server interface.
type Server struct {
accountingGRPC.UnimplementedAccountingServiceServer
srv accountingsvc.Server
}

Expand Down
1 change: 1 addition & 0 deletions pkg/network/transport/container/grpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// Server wraps NeoFS API Container service and
// provides gRPC Container service server interface.
type Server struct {
containerGRPC.UnimplementedContainerServiceServer
srv containersvc.Server
}

Expand Down
1 change: 1 addition & 0 deletions pkg/network/transport/netmap/grpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// Server wraps NeoFS API Netmap service and
// provides gRPC Netmap service server interface.
type Server struct {
netmapGRPC.UnimplementedNetmapServiceServer
srv netmapsvc.Server
}

Expand Down
1 change: 1 addition & 0 deletions pkg/network/transport/object/grpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
// Server wraps NeoFS API Object service and
// provides gRPC Object service server interface.
type Server struct {
objectGRPC.UnimplementedObjectServiceServer
srv objectSvc.ServiceServer
}

Expand Down
11 changes: 6 additions & 5 deletions pkg/network/transport/reputation/grpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"context"

"github.com/nspcc-dev/neofs-api-go/v2/reputation"
reputation2 "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc"
reputationgrpc "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc"
reputationrpc "github.com/nspcc-dev/neofs-node/pkg/services/reputation/rpc"
)

// Server wraps NeoFS API v2 Reputation service server
// and provides gRPC Reputation service server interface.
type Server struct {
reputationgrpc.UnimplementedReputationServiceServer
srv reputationrpc.Server
}

Expand All @@ -21,7 +22,7 @@ func New(srv reputationrpc.Server) *Server {
}
}

func (s *Server) AnnounceLocalTrust(ctx context.Context, r *reputation2.AnnounceLocalTrustRequest) (*reputation2.AnnounceLocalTrustResponse, error) {
func (s *Server) AnnounceLocalTrust(ctx context.Context, r *reputationgrpc.AnnounceLocalTrustRequest) (*reputationgrpc.AnnounceLocalTrustResponse, error) {
req := new(reputation.AnnounceLocalTrustRequest)
if err := req.FromGRPCMessage(r); err != nil {
return nil, err
Expand All @@ -32,10 +33,10 @@ func (s *Server) AnnounceLocalTrust(ctx context.Context, r *reputation2.Announce
return nil, err
}

return resp.ToGRPCMessage().(*reputation2.AnnounceLocalTrustResponse), nil
return resp.ToGRPCMessage().(*reputationgrpc.AnnounceLocalTrustResponse), nil
}

func (s *Server) AnnounceIntermediateResult(ctx context.Context, r *reputation2.AnnounceIntermediateResultRequest) (*reputation2.AnnounceIntermediateResultResponse, error) {
func (s *Server) AnnounceIntermediateResult(ctx context.Context, r *reputationgrpc.AnnounceIntermediateResultRequest) (*reputationgrpc.AnnounceIntermediateResultResponse, error) {
req := new(reputation.AnnounceIntermediateResultRequest)
if err := req.FromGRPCMessage(r); err != nil {
return nil, err
Expand All @@ -46,5 +47,5 @@ func (s *Server) AnnounceIntermediateResult(ctx context.Context, r *reputation2.
return nil, err
}

return resp.ToGRPCMessage().(*reputation2.AnnounceIntermediateResultResponse), nil
return resp.ToGRPCMessage().(*reputationgrpc.AnnounceIntermediateResultResponse), nil
}
1 change: 1 addition & 0 deletions pkg/network/transport/session/grpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// Server wraps NeoFS API Session service and
// provides gRPC Session service server interface.
type Server struct {
sessionGRPC.UnimplementedSessionServiceServer
srv sessionsvc.Server
}

Expand Down

0 comments on commit 0f81d20

Please sign in to comment.