[#306] Rename Private service to Control service

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
support/v0.27
Leonard Lyubich 2021-01-13 16:46:39 +03:00 committed by Alex Vanin
parent df3746fa68
commit abd9952e46
16 changed files with 172 additions and 172 deletions

View File

@ -66,7 +66,7 @@ protoc:
@for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \
echo "⇒ Processing $$f "; \
protoc \
--proto_path=.:./vendor:./vendor/github.com/nspcc-dev/neofs-api-go:/usr/local/include:./pkg/services/private \
--proto_path=.:./vendor:./vendor/github.com/nspcc-dev/neofs-api-go:/usr/local/include:./pkg/services/control \
--gofast_out=plugins=grpc,paths=source_relative:. $$f; \
done
rm -rf vendor

View File

@ -5,13 +5,13 @@ import (
"github.com/nspcc-dev/neofs-api-go/util/signature"
"github.com/nspcc-dev/neofs-api-go/v2/client"
"github.com/nspcc-dev/neofs-node/pkg/services/private"
privateSvc "github.com/nspcc-dev/neofs-node/pkg/services/private/server"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server"
"github.com/spf13/cobra"
)
var privateCmd = &cobra.Command{
Use: "private",
var controlCmd = &cobra.Command{
Use: "control",
Short: "Operations with storage node",
Long: `Operations with storage node`,
}
@ -24,9 +24,9 @@ var healthCheckCmd = &cobra.Command{
}
func init() {
rootCmd.AddCommand(privateCmd)
rootCmd.AddCommand(controlCmd)
privateCmd.AddCommand(healthCheckCmd)
controlCmd.AddCommand(healthCheckCmd)
}
func healthCheck(cmd *cobra.Command, _ []string) error {
@ -35,11 +35,11 @@ func healthCheck(cmd *cobra.Command, _ []string) error {
return err
}
req := new(private.HealthCheckRequest)
req := new(control.HealthCheckRequest)
req.SetBody(new(private.HealthCheckRequest_Body))
req.SetBody(new(control.HealthCheckRequest_Body))
if err := privateSvc.SignMessage(key, req); err != nil {
if err := controlSvc.SignMessage(key, req); err != nil {
return err
}
@ -60,7 +60,7 @@ func healthCheck(cmd *cobra.Command, _ []string) error {
return err
}
cli := private.NewPrivateServiceClient(con)
cli := control.NewControlServiceClient(con)
resp, err := cli.HealthCheck(context.Background(), req)
if err != nil {

View File

@ -28,7 +28,7 @@ import (
nmwrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
"github.com/nspcc-dev/neofs-node/pkg/network"
"github.com/nspcc-dev/neofs-node/pkg/services/private"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
tokenStorage "github.com/nspcc-dev/neofs-node/pkg/services/session/storage"
"github.com/nspcc-dev/neofs-node/pkg/services/util/response"
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
@ -182,7 +182,7 @@ type cfg struct {
respSvc *response.Service
cfgPrivateService cfgPrivateService
cfgControlService cfgControlService
healthStatus *atomic.Int32
}
@ -264,7 +264,7 @@ type cfgObjectRoutines struct {
get, head, put, search, rng, rngHash *ants.Pool
}
type cfgPrivateService struct {
type cfgControlService struct {
server *grpc.Server
}
@ -342,7 +342,7 @@ func initCfg(path string) *cfg {
cfgObject: cfgObject{
pool: initObjectPool(viperCfg),
},
healthStatus: atomic.NewInt32(int32(private.HealthStatus_STATUS_UNDEFINED)),
healthStatus: atomic.NewInt32(int32(control.HealthStatus_STATUS_UNDEFINED)),
}
initLocalStorage(c)
@ -424,7 +424,7 @@ func defaultConfiguration(v *viper.Viper) {
v.SetDefault(cfgObjectRangePoolSize, 10)
v.SetDefault(cfgObjectRangeHashPoolSize, 10)
v.SetDefault(cfgPrivateSvcAllowedKeys, []string{})
v.SetDefault(cfgCtrlSvcAllowedKeys, []string{})
}
func (c *cfg) LocalAddress() *network.Address {

View File

@ -0,0 +1,76 @@
package main
import (
"context"
"encoding/hex"
"net"
crypto "github.com/nspcc-dev/neofs-crypto"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server"
"github.com/pkg/errors"
"google.golang.org/grpc"
)
const (
cfgCtrlSvcSection = "control"
cfgCtrlSvcAllowedKeys = cfgCtrlSvcSection + ".permitted_keys"
cfgCtrlSvcGRPCSection = cfgCtrlSvcSection + ".grpc"
cfgCtrlGRPCEndpoint = cfgCtrlSvcGRPCSection + ".endpoint"
)
func initControlService(c *cfg) {
strKeys := c.viper.GetStringSlice(cfgCtrlSvcAllowedKeys)
keys := make([][]byte, 0, len(strKeys)+1) // +1 for node key
keys = append(keys, crypto.MarshalPublicKey(&c.key.PublicKey))
for i := range strKeys {
key, err := hex.DecodeString(strKeys[i])
fatalOnErr(err)
if crypto.UnmarshalPublicKey(key) == nil {
fatalOnErr(errors.Errorf("invalid permitted key for Control service %s", strKeys[i]))
}
keys = append(keys, key)
}
ctlSvc := controlSvc.New(
controlSvc.WithKey(c.key),
controlSvc.WithAllowedKeys(keys),
controlSvc.WithHealthChecker(c),
)
var (
err error
lis net.Listener
endpoint = c.viper.GetString(cfgCtrlGRPCEndpoint)
)
if endpoint == "" || endpoint == c.viper.GetString(cfgListenAddress) {
lis = c.cfgGRPC.listener
c.cfgControlService.server = c.cfgGRPC.server
} else {
lis, err = net.Listen("tcp", endpoint)
fatalOnErr(err)
c.cfgControlService.server = grpc.NewServer()
}
control.RegisterControlServiceServer(c.cfgControlService.server, ctlSvc)
c.workers = append(c.workers, newWorkerFromFunc(func(ctx context.Context) {
fatalOnErr(c.cfgControlService.server.Serve(lis))
}))
}
func (c *cfg) setHealthStatus(st control.HealthStatus) {
c.healthStatus.Store(int32(st))
}
func (c *cfg) HealthStatus() control.HealthStatus {
return control.HealthStatus(c.healthStatus.Load())
}

View File

@ -5,7 +5,7 @@ import (
"flag"
"log"
"github.com/nspcc-dev/neofs-node/pkg/services/private"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
"github.com/nspcc-dev/neofs-node/pkg/util/grace"
"go.uber.org/zap"
)
@ -42,7 +42,7 @@ func initApp(c *cfg) {
initSessionService(c)
initObjectService(c)
initProfiler(c)
initPrivateService(c)
initControlService(c)
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Open())
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Init())
@ -56,7 +56,7 @@ func bootUp(c *cfg) {
bootstrapNode(c)
startWorkers(c)
c.setHealthStatus(private.HealthStatus_ONLINE)
c.setHealthStatus(control.HealthStatus_ONLINE)
}
func wait(c *cfg) {
@ -75,7 +75,7 @@ func wait(c *cfg) {
func shutdown(c *cfg) {
c.cfgGRPC.server.GracefulStop()
c.cfgPrivateService.server.GracefulStop()
c.cfgControlService.server.GracefulStop()
c.log.Info("gRPC server stopped")

View File

@ -7,8 +7,8 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
netmapTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/netmap/grpc"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
netmapService "github.com/nspcc-dev/neofs-node/pkg/services/netmap"
"github.com/nspcc-dev/neofs-node/pkg/services/private"
"github.com/pkg/errors"
"go.uber.org/atomic"
"go.uber.org/zap"
@ -117,7 +117,7 @@ func addNewEpochNotificationHandler(c *cfg, h event.Handler) {
}
func goOffline(c *cfg) {
c.setHealthStatus(private.HealthStatus_OFFLINE)
c.setHealthStatus(control.HealthStatus_OFFLINE)
err := c.cfgNetmap.wrapper.UpdatePeerState(
crypto.MarshalPublicKey(&c.key.PublicKey),

View File

@ -1,76 +0,0 @@
package main
import (
"context"
"encoding/hex"
"net"
crypto "github.com/nspcc-dev/neofs-crypto"
"github.com/nspcc-dev/neofs-node/pkg/services/private"
privateSvc "github.com/nspcc-dev/neofs-node/pkg/services/private/server"
"github.com/pkg/errors"
"google.golang.org/grpc"
)
const (
cfgPrivateSvcSection = "private"
cfgPrivateSvcAllowedKeys = cfgPrivateSvcSection + ".permitted_keys"
cfgPrivateSvcGRPCSection = cfgPrivateSvcSection + ".grpc"
cfgPrivateGRPCEndpoint = cfgPrivateSvcGRPCSection + ".endpoint"
)
func initPrivateService(c *cfg) {
strKeys := c.viper.GetStringSlice(cfgPrivateSvcAllowedKeys)
keys := make([][]byte, 0, len(strKeys)+1) // +1 for node key
keys = append(keys, crypto.MarshalPublicKey(&c.key.PublicKey))
for i := range strKeys {
key, err := hex.DecodeString(strKeys[i])
fatalOnErr(err)
if crypto.UnmarshalPublicKey(key) == nil {
fatalOnErr(errors.Errorf("invalid permitted key for private service %s", strKeys[i]))
}
keys = append(keys, key)
}
privSvc := privateSvc.New(
privateSvc.WithKey(c.key),
privateSvc.WithAllowedKeys(keys),
privateSvc.WithHealthChecker(c),
)
var (
err error
lis net.Listener
endpoint = c.viper.GetString(cfgPrivateGRPCEndpoint)
)
if endpoint == "" || endpoint == c.viper.GetString(cfgListenAddress) {
lis = c.cfgGRPC.listener
c.cfgPrivateService.server = c.cfgGRPC.server
} else {
lis, err = net.Listen("tcp", endpoint)
fatalOnErr(err)
c.cfgPrivateService.server = grpc.NewServer()
}
private.RegisterPrivateServiceServer(c.cfgPrivateService.server, privSvc)
c.workers = append(c.workers, newWorkerFromFunc(func(ctx context.Context) {
fatalOnErr(c.cfgPrivateService.server.Serve(lis))
}))
}
func (c *cfg) setHealthStatus(st private.HealthStatus) {
c.healthStatus.Store(int32(st))
}
func (c *cfg) HealthStatus() private.HealthStatus {
return private.HealthStatus(c.healthStatus.Load())
}

View File

@ -1,9 +1,9 @@
package private
package control
import (
"context"
"github.com/nspcc-dev/neofs-node/pkg/services/private"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
@ -11,16 +11,16 @@ import (
// HealthCheck returns health status of the local node.
//
// If request is unsigned or signed by disallowed key, permission error returns.
func (s *Server) HealthCheck(_ context.Context, req *private.HealthCheckRequest) (*private.HealthCheckResponse, error) {
func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest) (*control.HealthCheckResponse, error) {
// verify request
if err := s.isValidRequest(req); err != nil {
return nil, status.Error(codes.PermissionDenied, err.Error())
}
// create and fill response
resp := new(private.HealthCheckResponse)
resp := new(control.HealthCheckResponse)
body := new(private.HealthCheckResponse_Body)
body := new(control.HealthCheckResponse_Body)
resp.SetBody(body)
body.SetStatus(s.healthChecker.HealthStatus())

View File

@ -1,13 +1,13 @@
package private
package control
import (
"crypto/ecdsa"
"github.com/nspcc-dev/neofs-node/pkg/services/private"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
)
// Server is an entity that serves
// Private service on storage node.
// Control service on storage node.
type Server struct {
*cfg
}
@ -18,8 +18,8 @@ type HealthChecker interface {
// Must calculate and return current node health status.
//
// If status can not be calculated for any reason,
// private.HealthStatus_STATUS_UNDEFINED should be returned.
HealthStatus() private.HealthStatus
// control.HealthStatus_STATUS_UNDEFINED should be returned.
HealthStatus() control.HealthStatus
}
// Option of the Server's constructor.
@ -59,7 +59,7 @@ func WithKey(key *ecdsa.PrivateKey) Option {
}
// WithAllowedKeys returns option to add list of public
// keys that have rights to use private service.
// keys that have rights to use Control service.
func WithAllowedKeys(keys [][]byte) Option {
return func(c *cfg) {
c.allowedKeys = append(c.allowedKeys, keys...)

View File

@ -1,4 +1,4 @@
package private
package control
import (
"bytes"
@ -6,14 +6,14 @@ import (
"errors"
"github.com/nspcc-dev/neofs-api-go/util/signature"
"github.com/nspcc-dev/neofs-node/pkg/services/private"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
)
// SignedMessage is an interface of Private service message.
// SignedMessage is an interface of Control service message.
type SignedMessage interface {
signature.DataSource
GetSignature() *private.Signature
SetSignature(*private.Signature)
GetSignature() *control.Signature
SetSignature(*control.Signature)
}
var errDisallowedKey = errors.New("key is not in the allowed list")
@ -42,10 +42,10 @@ func (s *Server) isValidRequest(req SignedMessage) error {
})
}
// SignMessage signs Private service message with private key.
// SignMessage signs Control service message with private key.
func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error {
return signature.SignDataWithHandler(key, msg, func(key []byte, sig []byte) {
s := new(private.Signature)
s := new(control.Signature)
s.SetKey(key)
s.SetSign(sig)

View File

@ -1,4 +1,4 @@
package private
package control
// SetBody sets health check request body.
func (m *HealthCheckRequest) SetBody(v *HealthCheckRequest_Body) {

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: pkg/services/private/service.proto
// source: pkg/services/control/service.proto
package private
package control
import (
context "context"
@ -38,7 +38,7 @@ func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} }
func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) }
func (*HealthCheckRequest) ProtoMessage() {}
func (*HealthCheckRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_730cfa0cfa54ede8, []int{0}
return fileDescriptor_d828cf854a991d79, []int{0}
}
func (m *HealthCheckRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -92,7 +92,7 @@ func (m *HealthCheckRequest_Body) Reset() { *m = HealthCheckRequest_Body
func (m *HealthCheckRequest_Body) String() string { return proto.CompactTextString(m) }
func (*HealthCheckRequest_Body) ProtoMessage() {}
func (*HealthCheckRequest_Body) Descriptor() ([]byte, []int) {
return fileDescriptor_730cfa0cfa54ede8, []int{0, 0}
return fileDescriptor_d828cf854a991d79, []int{0, 0}
}
func (m *HealthCheckRequest_Body) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -136,7 +136,7 @@ func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} }
func (m *HealthCheckResponse) String() string { return proto.CompactTextString(m) }
func (*HealthCheckResponse) ProtoMessage() {}
func (*HealthCheckResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_730cfa0cfa54ede8, []int{1}
return fileDescriptor_d828cf854a991d79, []int{1}
}
func (m *HealthCheckResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -182,7 +182,7 @@ func (m *HealthCheckResponse) GetSignature() *Signature {
// Health check response body
type HealthCheckResponse_Body struct {
// Health status of storage node.
Status HealthStatus `protobuf:"varint,1,opt,name=status,proto3,enum=private.HealthStatus" json:"status,omitempty"`
Status HealthStatus `protobuf:"varint,1,opt,name=status,proto3,enum=control.HealthStatus" json:"status,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -192,7 +192,7 @@ func (m *HealthCheckResponse_Body) Reset() { *m = HealthCheckResponse_Bo
func (m *HealthCheckResponse_Body) String() string { return proto.CompactTextString(m) }
func (*HealthCheckResponse_Body) ProtoMessage() {}
func (*HealthCheckResponse_Body) Descriptor() ([]byte, []int) {
return fileDescriptor_730cfa0cfa54ede8, []int{1, 0}
return fileDescriptor_d828cf854a991d79, []int{1, 0}
}
func (m *HealthCheckResponse_Body) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -229,19 +229,19 @@ func (m *HealthCheckResponse_Body) GetStatus() HealthStatus {
}
func init() {
proto.RegisterType((*HealthCheckRequest)(nil), "private.HealthCheckRequest")
proto.RegisterType((*HealthCheckRequest_Body)(nil), "private.HealthCheckRequest.Body")
proto.RegisterType((*HealthCheckResponse)(nil), "private.HealthCheckResponse")
proto.RegisterType((*HealthCheckResponse_Body)(nil), "private.HealthCheckResponse.Body")
proto.RegisterType((*HealthCheckRequest)(nil), "control.HealthCheckRequest")
proto.RegisterType((*HealthCheckRequest_Body)(nil), "control.HealthCheckRequest.Body")
proto.RegisterType((*HealthCheckResponse)(nil), "control.HealthCheckResponse")
proto.RegisterType((*HealthCheckResponse_Body)(nil), "control.HealthCheckResponse.Body")
}
func init() { proto.RegisterFile("pkg/services/private/service.proto", fileDescriptor_730cfa0cfa54ede8) }
func init() { proto.RegisterFile("pkg/services/control/service.proto", fileDescriptor_d828cf854a991d79) }
var fileDescriptor_730cfa0cfa54ede8 = []byte{
var fileDescriptor_d828cf854a991d79 = []byte{
// 291 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0xc8, 0x4e, 0xd7,
0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2c, 0x4b, 0x2c, 0x49,
0x85, 0x09, 0xe8, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xb1, 0x43, 0x85, 0xa5, 0xb8, 0x4b, 0x2a,
0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0x2d, 0xd6, 0x4f, 0xce, 0xcf, 0x2b, 0x29, 0xca, 0xcf,
0x81, 0x09, 0xe8, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xb1, 0x43, 0x85, 0xa5, 0xb8, 0x4b, 0x2a,
0x0b, 0x52, 0x8b, 0x21, 0xa2, 0x4a, 0x2d, 0x8c, 0x5c, 0x42, 0x1e, 0xa9, 0x89, 0x39, 0x25, 0x19,
0xce, 0x19, 0xa9, 0xc9, 0xd9, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x26, 0x5c, 0x2c,
0x49, 0xf9, 0x29, 0x95, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x0a, 0x7a, 0x50, 0xbd, 0x7a,
@ -251,12 +251,12 @@ var fileDescriptor_730cfa0cfa54ede8 = []byte{
0xcc, 0x2e, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x15, 0x32, 0x45, 0x71, 0x87, 0x22, 0x76, 0x77, 0x40,
0xd4, 0x52, 0xe6, 0x10, 0x53, 0x88, 0x43, 0x84, 0x74, 0xb9, 0xd8, 0x8a, 0x4b, 0x12, 0x4b, 0x4a,
0x8b, 0xc1, 0x56, 0xf2, 0x19, 0x89, 0xa2, 0x59, 0x19, 0x0c, 0x96, 0x0c, 0x82, 0x2a, 0x32, 0x8a,
0xe2, 0xe2, 0x0b, 0x80, 0xc8, 0x07, 0x43, 0x02, 0x5b, 0xc8, 0x83, 0x8b, 0x1b, 0xc9, 0x71, 0x42,
0xe2, 0xe2, 0x73, 0x86, 0xc8, 0x07, 0x43, 0x02, 0x5b, 0xc8, 0x83, 0x8b, 0x1b, 0xc9, 0x71, 0x42,
0xd2, 0x78, 0x82, 0x4e, 0x4a, 0x06, 0x9f, 0x7f, 0x9c, 0xdc, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0,
0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x19, 0x8f, 0xe5, 0x18, 0xa2, 0x4c, 0xd2, 0x33, 0x4b,
0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52,
0xcb, 0xf4, 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, 0xf3, 0xf2, 0x53, 0x52, 0xf5, 0xb1, 0x25, 0x83,
0x24, 0x36, 0x70, 0x4c, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xae, 0x15, 0xa0, 0xdd, 0x25,
0x24, 0x36, 0x70, 0x4c, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xbe, 0x20, 0xe7, 0x25,
0x02, 0x00, 0x00,
}
@ -268,70 +268,70 @@ var _ grpc.ClientConn
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// PrivateServiceClient is the client API for PrivateService service.
// ControlServiceClient is the client API for ControlService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type PrivateServiceClient interface {
type ControlServiceClient interface {
// Performs health check of the storage node.
HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
}
type privateServiceClient struct {
type controlServiceClient struct {
cc *grpc.ClientConn
}
func NewPrivateServiceClient(cc *grpc.ClientConn) PrivateServiceClient {
return &privateServiceClient{cc}
func NewControlServiceClient(cc *grpc.ClientConn) ControlServiceClient {
return &controlServiceClient{cc}
}
func (c *privateServiceClient) HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
func (c *controlServiceClient) HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
out := new(HealthCheckResponse)
err := c.cc.Invoke(ctx, "/private.PrivateService/HealthCheck", in, out, opts...)
err := c.cc.Invoke(ctx, "/control.ControlService/HealthCheck", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// PrivateServiceServer is the server API for PrivateService service.
type PrivateServiceServer interface {
// ControlServiceServer is the server API for ControlService service.
type ControlServiceServer interface {
// Performs health check of the storage node.
HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
}
func RegisterPrivateServiceServer(s *grpc.Server, srv PrivateServiceServer) {
s.RegisterService(&_PrivateService_serviceDesc, srv)
func RegisterControlServiceServer(s *grpc.Server, srv ControlServiceServer) {
s.RegisterService(&_ControlService_serviceDesc, srv)
}
func _PrivateService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ControlService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HealthCheckRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PrivateServiceServer).HealthCheck(ctx, in)
return srv.(ControlServiceServer).HealthCheck(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/private.PrivateService/HealthCheck",
FullMethod: "/control.ControlService/HealthCheck",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PrivateServiceServer).HealthCheck(ctx, req.(*HealthCheckRequest))
return srv.(ControlServiceServer).HealthCheck(ctx, req.(*HealthCheckRequest))
}
return interceptor(ctx, in, info, handler)
}
var _PrivateService_serviceDesc = grpc.ServiceDesc{
ServiceName: "private.PrivateService",
HandlerType: (*PrivateServiceServer)(nil),
var _ControlService_serviceDesc = grpc.ServiceDesc{
ServiceName: "control.ControlService",
HandlerType: (*ControlServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "HealthCheck",
Handler: _PrivateService_HealthCheck_Handler,
Handler: _ControlService_HealthCheck_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "pkg/services/private/service.proto",
Metadata: "pkg/services/control/service.proto",
}
func (m *HealthCheckRequest) Marshal() (dAtA []byte, err error) {

View File

@ -1,13 +1,13 @@
syntax = "proto3";
package private;
package control;
import "types.proto";
option go_package = "github.com/nspcc-dev/neofs-node/pkg/services/private";
option go_package = "github.com/nspcc-dev/neofs-node/pkg/services/control";
// `PrivateService` provides an interface for internal work with the storage node.
service PrivateService {
// `ControlService` provides an interface for internal work with the storage node.
service ControlService {
// Performs health check of the storage node.
rpc HealthCheck (HealthCheckRequest) returns (HealthCheckResponse);
}

View File

@ -1,4 +1,4 @@
package private
package control
// SetKey sets public key used for signing.
func (m *Signature) SetKey(v []byte) {

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: pkg/services/private/types.proto
// source: pkg/services/control/types.proto
package private
package control
import (
fmt "fmt"
@ -50,7 +50,7 @@ func (x HealthStatus) String() string {
}
func (HealthStatus) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_d50f4a50d05f699c, []int{0}
return fileDescriptor_9c1109132c4fb65c, []int{0}
}
// Signature of some message.
@ -68,7 +68,7 @@ func (m *Signature) Reset() { *m = Signature{} }
func (m *Signature) String() string { return proto.CompactTextString(m) }
func (*Signature) ProtoMessage() {}
func (*Signature) Descriptor() ([]byte, []int) {
return fileDescriptor_d50f4a50d05f699c, []int{0}
return fileDescriptor_9c1109132c4fb65c, []int{0}
}
func (m *Signature) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -112,17 +112,17 @@ func (m *Signature) GetSign() []byte {
}
func init() {
proto.RegisterEnum("private.HealthStatus", HealthStatus_name, HealthStatus_value)
proto.RegisterType((*Signature)(nil), "private.Signature")
proto.RegisterEnum("control.HealthStatus", HealthStatus_name, HealthStatus_value)
proto.RegisterType((*Signature)(nil), "control.Signature")
}
func init() { proto.RegisterFile("pkg/services/private/types.proto", fileDescriptor_d50f4a50d05f699c) }
func init() { proto.RegisterFile("pkg/services/control/types.proto", fileDescriptor_9c1109132c4fb65c) }
var fileDescriptor_d50f4a50d05f699c = []byte{
var fileDescriptor_9c1109132c4fb65c = []byte{
// 227 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0xc8, 0x4e, 0xd7,
0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2c, 0x4b, 0x2c, 0x49,
0xd5, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x0a,
0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0x2d, 0xd6, 0x4f, 0xce, 0xcf, 0x2b, 0x29, 0xca, 0xcf,
0xd1, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x0a,
0x2a, 0x99, 0x71, 0x71, 0x06, 0x67, 0xa6, 0xe7, 0x25, 0x96, 0x94, 0x16, 0xa5, 0x0a, 0x09, 0x70,
0x31, 0x67, 0xa7, 0x56, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x81, 0x98, 0x42, 0xe2, 0x5c,
0x2c, 0xc5, 0x99, 0xe9, 0x79, 0x12, 0x4c, 0x60, 0x21, 0xce, 0x62, 0x98, 0x52, 0x2d, 0x5b, 0x2e,
@ -133,7 +133,7 @@ var fileDescriptor_d50f4a50d05f699c = []byte{
0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x24, 0x3d, 0xb3,
0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0xaf, 0xb8, 0x20, 0x39, 0x59, 0x37, 0x25,
0xb5, 0x4c, 0x3f, 0x2f, 0x35, 0x3f, 0xad, 0x58, 0x37, 0x2f, 0x3f, 0x25, 0x55, 0x1f, 0x9b, 0x9f,
0x92, 0xd8, 0xc0, 0xde, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x57, 0x15, 0x0c, 0xc5, 0xf2,
0x92, 0xd8, 0xc0, 0xde, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x31, 0x42, 0x61, 0xf2,
0x00, 0x00, 0x00,
}

View File

@ -1,8 +1,8 @@
syntax = "proto3";
package private;
package control;
option go_package = "github.com/nspcc-dev/neofs-node/pkg/services/private";
option go_package = "github.com/nspcc-dev/neofs-node/pkg/services/control";
// Signature of some message.
message Signature {