Unverified Commit 85effc8d authored by Cristian Maglie's avatar Cristian Maglie Committed by GitHub

Allow SIGINT (ctrl-C) to be forwarded to debugger process (#596)

* Allow SIGINT (ctrl-C) to be forwarded to debugger process

* Send the correct signal to process
parent 88468f21
......@@ -18,6 +18,7 @@ package debug
import (
"context"
"os"
"os/signal"
"github.com/arduino/arduino-cli/cli/errorcodes"
"github.com/arduino/arduino-cli/cli/feedback"
......@@ -68,13 +69,17 @@ func run(command *cobra.Command, args []string) {
}
sketchPath := initSketchPath(path)
// Intercept SIGINT and forward them to debug process
ctrlc := make(chan os.Signal, 1)
signal.Notify(ctrlc, os.Interrupt)
if _, err := debug.Debug(context.Background(), &dbg.DebugConfigReq{
Instance: &dbg.Instance{Id: instance.GetId()},
Fqbn: fqbn,
SketchPath: sketchPath.String(),
Port: port,
ImportFile: importFile,
}, os.Stdin, os.Stdout); err != nil {
}, os.Stdin, os.Stdout, ctrlc); err != nil {
feedback.Errorf("Error during Debug: %v", err)
os.Exit(errorcodes.ErrGeneric)
}
......
......@@ -16,6 +16,8 @@
package daemon
import (
"os"
"github.com/arduino/arduino-cli/arduino/utils"
cmd "github.com/arduino/arduino-cli/commands/debug"
dbg "github.com/arduino/arduino-cli/rpc/debug"
......@@ -43,14 +45,20 @@ func (s *DebugService) Debug(stream dbg.Debug_DebugServer) error {
}
// Launch debug recipe attaching stdin and out to grpc streaming
signalChan := make(chan os.Signal)
defer close(signalChan)
resp, err := cmd.Debug(stream.Context(), req,
utils.ConsumeStreamFrom(func() ([]byte, error) {
command, err := stream.Recv()
if command.GetSendInterrupt() {
signalChan <- os.Interrupt
}
return command.GetData(), err
}),
utils.FeedStreamTo(func(data []byte) {
stream.Send(&dbg.DebugResp{Data: data})
}))
}),
signalChan)
if err != nil {
return (err)
}
......
......@@ -18,7 +18,6 @@ package debug
import (
"context"
"fmt"
"github.com/pkg/errors"
"io"
"os"
"path/filepath"
......@@ -33,6 +32,7 @@ import (
dbg "github.com/arduino/arduino-cli/rpc/debug"
"github.com/arduino/go-paths-helper"
"github.com/arduino/go-properties-orderedmap"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
......@@ -42,7 +42,7 @@ import (
// grpc Out <- tool stdOut
// grpc Out <- tool stdErr
// It also implements tool process lifecycle management
func Debug(ctx context.Context, req *dbg.DebugConfigReq, inStream io.Reader, out io.Writer) (*dbg.DebugResp, error) {
func Debug(ctx context.Context, req *dbg.DebugConfigReq, inStream io.Reader, out io.Writer, interrupt <-chan os.Signal) (*dbg.DebugResp, error) {
// Get tool commandLine from core recipe
pm := commands.GetPackageManager(req.GetInstance().GetId())
......@@ -73,6 +73,18 @@ func Debug(ctx context.Context, req *dbg.DebugConfigReq, inStream io.Reader, out
return &dbg.DebugResp{Error: err.Error()}, nil
}
if interrupt != nil {
go func() {
for {
if sig, ok := <-interrupt; !ok {
break
} else {
cmd.Process.Signal(sig)
}
}
}()
}
go func() {
// Copy data from passed inStream into command stdIn
io.Copy(in, inStream)
......
......@@ -8,6 +8,8 @@ import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math"
)
......@@ -597,11 +599,11 @@ var fileDescriptor_3690061a1131852d = []byte{
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
const _ = grpc.SupportPackageIsVersion6
// ArduinoCoreClient is the client API for ArduinoCore service.
//
......@@ -641,10 +643,10 @@ type ArduinoCoreClient interface {
}
type arduinoCoreClient struct {
cc *grpc.ClientConn
cc grpc.ClientConnInterface
}
func NewArduinoCoreClient(cc *grpc.ClientConn) ArduinoCoreClient {
func NewArduinoCoreClient(cc grpc.ClientConnInterface) ArduinoCoreClient {
return &arduinoCoreClient{cc}
}
......@@ -1230,6 +1232,86 @@ type ArduinoCoreServer interface {
LibraryList(context.Context, *LibraryListReq) (*LibraryListResp, error)
}
// UnimplementedArduinoCoreServer can be embedded to have forward compatible implementations.
type UnimplementedArduinoCoreServer struct {
}
func (*UnimplementedArduinoCoreServer) Init(req *InitReq, srv ArduinoCore_InitServer) error {
return status.Errorf(codes.Unimplemented, "method Init not implemented")
}
func (*UnimplementedArduinoCoreServer) Destroy(ctx context.Context, req *DestroyReq) (*DestroyResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Destroy not implemented")
}
func (*UnimplementedArduinoCoreServer) Rescan(ctx context.Context, req *RescanReq) (*RescanResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Rescan not implemented")
}
func (*UnimplementedArduinoCoreServer) UpdateIndex(req *UpdateIndexReq, srv ArduinoCore_UpdateIndexServer) error {
return status.Errorf(codes.Unimplemented, "method UpdateIndex not implemented")
}
func (*UnimplementedArduinoCoreServer) UpdateLibrariesIndex(req *UpdateLibrariesIndexReq, srv ArduinoCore_UpdateLibrariesIndexServer) error {
return status.Errorf(codes.Unimplemented, "method UpdateLibrariesIndex not implemented")
}
func (*UnimplementedArduinoCoreServer) Version(ctx context.Context, req *VersionReq) (*VersionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Version not implemented")
}
func (*UnimplementedArduinoCoreServer) BoardDetails(ctx context.Context, req *BoardDetailsReq) (*BoardDetailsResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method BoardDetails not implemented")
}
func (*UnimplementedArduinoCoreServer) BoardAttach(req *BoardAttachReq, srv ArduinoCore_BoardAttachServer) error {
return status.Errorf(codes.Unimplemented, "method BoardAttach not implemented")
}
func (*UnimplementedArduinoCoreServer) BoardList(ctx context.Context, req *BoardListReq) (*BoardListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method BoardList not implemented")
}
func (*UnimplementedArduinoCoreServer) BoardListAll(ctx context.Context, req *BoardListAllReq) (*BoardListAllResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method BoardListAll not implemented")
}
func (*UnimplementedArduinoCoreServer) Compile(req *CompileReq, srv ArduinoCore_CompileServer) error {
return status.Errorf(codes.Unimplemented, "method Compile not implemented")
}
func (*UnimplementedArduinoCoreServer) PlatformInstall(req *PlatformInstallReq, srv ArduinoCore_PlatformInstallServer) error {
return status.Errorf(codes.Unimplemented, "method PlatformInstall not implemented")
}
func (*UnimplementedArduinoCoreServer) PlatformDownload(req *PlatformDownloadReq, srv ArduinoCore_PlatformDownloadServer) error {
return status.Errorf(codes.Unimplemented, "method PlatformDownload not implemented")
}
func (*UnimplementedArduinoCoreServer) PlatformUninstall(req *PlatformUninstallReq, srv ArduinoCore_PlatformUninstallServer) error {
return status.Errorf(codes.Unimplemented, "method PlatformUninstall not implemented")
}
func (*UnimplementedArduinoCoreServer) PlatformUpgrade(req *PlatformUpgradeReq, srv ArduinoCore_PlatformUpgradeServer) error {
return status.Errorf(codes.Unimplemented, "method PlatformUpgrade not implemented")
}
func (*UnimplementedArduinoCoreServer) Upload(req *UploadReq, srv ArduinoCore_UploadServer) error {
return status.Errorf(codes.Unimplemented, "method Upload not implemented")
}
func (*UnimplementedArduinoCoreServer) PlatformSearch(ctx context.Context, req *PlatformSearchReq) (*PlatformSearchResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method PlatformSearch not implemented")
}
func (*UnimplementedArduinoCoreServer) PlatformList(ctx context.Context, req *PlatformListReq) (*PlatformListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method PlatformList not implemented")
}
func (*UnimplementedArduinoCoreServer) LibraryDownload(req *LibraryDownloadReq, srv ArduinoCore_LibraryDownloadServer) error {
return status.Errorf(codes.Unimplemented, "method LibraryDownload not implemented")
}
func (*UnimplementedArduinoCoreServer) LibraryInstall(req *LibraryInstallReq, srv ArduinoCore_LibraryInstallServer) error {
return status.Errorf(codes.Unimplemented, "method LibraryInstall not implemented")
}
func (*UnimplementedArduinoCoreServer) LibraryUninstall(req *LibraryUninstallReq, srv ArduinoCore_LibraryUninstallServer) error {
return status.Errorf(codes.Unimplemented, "method LibraryUninstall not implemented")
}
func (*UnimplementedArduinoCoreServer) LibraryUpgradeAll(req *LibraryUpgradeAllReq, srv ArduinoCore_LibraryUpgradeAllServer) error {
return status.Errorf(codes.Unimplemented, "method LibraryUpgradeAll not implemented")
}
func (*UnimplementedArduinoCoreServer) LibraryResolveDependencies(ctx context.Context, req *LibraryResolveDependenciesReq) (*LibraryResolveDependenciesResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method LibraryResolveDependencies not implemented")
}
func (*UnimplementedArduinoCoreServer) LibrarySearch(ctx context.Context, req *LibrarySearchReq) (*LibrarySearchResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method LibrarySearch not implemented")
}
func (*UnimplementedArduinoCoreServer) LibraryList(ctx context.Context, req *LibraryListReq) (*LibraryListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method LibraryList not implemented")
}
func RegisterArduinoCoreServer(s *grpc.Server, srv ArduinoCoreServer) {
s.RegisterService(&_ArduinoCore_serviceDesc, srv)
}
......
......@@ -8,6 +8,8 @@ import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math"
)
......@@ -33,7 +35,9 @@ type DebugReq struct {
// message.
DebugReq *DebugConfigReq `protobuf:"bytes,1,opt,name=debugReq,proto3" json:"debugReq,omitempty"`
// The data to be sent to the target being monitored.
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
// Set this to true to send and Interrupt signal to the debugger process
SendInterrupt bool `protobuf:"varint,3,opt,name=send_interrupt,json=sendInterrupt,proto3" json:"send_interrupt,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -78,6 +82,13 @@ func (m *DebugReq) GetData() []byte {
return nil
}
func (m *DebugReq) GetSendInterrupt() bool {
if m != nil {
return m.SendInterrupt
}
return false
}
type DebugConfigReq struct {
Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"`
Fqbn string `protobuf:"bytes,2,opt,name=fqbn,proto3" json:"fqbn,omitempty"`
......@@ -255,37 +266,39 @@ func init() {
func init() { proto.RegisterFile("debug/debug.proto", fileDescriptor_5ae24eab94cb53d5) }
var fileDescriptor_5ae24eab94cb53d5 = []byte{
// 332 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x41, 0x4b, 0xf3, 0x40,
0x10, 0xfd, 0xb6, 0x5f, 0x63, 0xd3, 0xa9, 0x14, 0x5c, 0x7a, 0x58, 0x7a, 0x68, 0x4b, 0xf0, 0x10,
0x04, 0xb7, 0x52, 0xf1, 0xe2, 0x49, 0x54, 0x04, 0x2f, 0x22, 0x7b, 0x11, 0xbc, 0xd4, 0x64, 0xb3,
0x6d, 0x16, 0xd3, 0x6c, 0xba, 0xd9, 0xfa, 0x3b, 0xfd, 0x49, 0xb2, 0x9b, 0x4d, 0x45, 0x28, 0xbd,
0x24, 0x6f, 0x66, 0xde, 0x9b, 0xb7, 0x33, 0x0c, 0x9c, 0x65, 0x22, 0xdd, 0xad, 0xe7, 0xee, 0x4b,
0x2b, 0xad, 0x8c, 0xc2, 0x23, 0xce, 0x69, 0xa2, 0xb3, 0x9d, 0x2c, 0x15, 0xe5, 0x85, 0xa4, 0xae,
0x16, 0x7d, 0x40, 0xf8, 0x68, 0x01, 0x13, 0x5b, 0x7c, 0x07, 0x61, 0xe6, 0x31, 0x41, 0x33, 0x14,
0x0f, 0x16, 0xe7, 0xf4, 0x90, 0x88, 0x3a, 0xc5, 0x83, 0x2a, 0x57, 0xd2, 0x72, 0xd9, 0x5e, 0x85,
0x31, 0x74, 0xb3, 0xc4, 0x24, 0xa4, 0x33, 0x43, 0xf1, 0x29, 0x73, 0x38, 0xfa, 0x46, 0x30, 0xfc,
0x2b, 0xc0, 0xb7, 0x10, 0xca, 0xb2, 0x36, 0x49, 0xc9, 0x85, 0x37, 0x9a, 0x1c, 0x36, 0x7a, 0xf6,
0x2c, 0xb6, 0xe7, 0x5b, 0x8b, 0xd5, 0x36, 0x2d, 0x9d, 0x45, 0x9f, 0x39, 0x8c, 0xa7, 0x30, 0xa8,
0x3f, 0x85, 0xe1, 0xf9, 0xb2, 0x4a, 0x4c, 0x4e, 0xfe, 0xbb, 0x12, 0x34, 0xa9, 0xd7, 0xc4, 0xe4,
0x56, 0x54, 0x29, 0x6d, 0x48, 0xb7, 0x11, 0x59, 0x8c, 0x09, 0xf4, 0xbe, 0x84, 0x4e, 0x55, 0x2d,
0x48, 0x30, 0x43, 0x71, 0xc8, 0xda, 0xd0, 0xb6, 0x93, 0x1b, 0xcb, 0x59, 0xae, 0x64, 0x21, 0x48,
0xaf, 0x69, 0xd7, 0xa4, 0x9e, 0x64, 0x21, 0xa2, 0x1b, 0xe8, 0xfb, 0xa5, 0xd5, 0xd5, 0x7e, 0x66,
0xf4, 0x3b, 0x33, 0x1e, 0x41, 0x20, 0xb4, 0x56, 0xda, 0xbf, 0xb2, 0x09, 0xa2, 0x31, 0x84, 0xed,
0x40, 0x78, 0x08, 0x1d, 0x99, 0x39, 0x4d, 0xc0, 0x3a, 0x32, 0x5b, 0xbc, 0x41, 0xe0, 0x5a, 0xe2,
0x97, 0x16, 0x4c, 0x8e, 0xec, 0x9e, 0x89, 0xed, 0x78, 0x7a, 0xb4, 0x5e, 0x57, 0xd1, 0xbf, 0x18,
0x5d, 0xa1, 0xfb, 0x8b, 0xf7, 0x78, 0x2d, 0x4d, 0xbe, 0x4b, 0x29, 0x57, 0x9b, 0xb9, 0xe7, 0xb7,
0xff, 0x4b, 0x5e, 0xc8, 0xb9, 0xae, 0x78, 0x73, 0x28, 0xe9, 0x89, 0xbb, 0x94, 0xeb, 0x9f, 0x00,
0x00, 0x00, 0xff, 0xff, 0xfc, 0x58, 0x74, 0x88, 0x3e, 0x02, 0x00, 0x00,
// 356 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x51, 0x4b, 0xeb, 0x30,
0x18, 0xbd, 0xd9, 0x5d, 0xef, 0xba, 0x6f, 0xd7, 0x81, 0x61, 0x0f, 0x65, 0x0f, 0xdb, 0x28, 0x0a,
0x45, 0xb0, 0x93, 0x89, 0x2f, 0x3e, 0x89, 0x8a, 0xb0, 0x17, 0x91, 0xbc, 0x08, 0xbe, 0x8c, 0x36,
0xcd, 0xd6, 0x60, 0x97, 0x64, 0x69, 0xea, 0x5f, 0xf0, 0xef, 0xf9, 0x93, 0x24, 0x69, 0x3b, 0x14,
0xc6, 0x5e, 0xda, 0x93, 0x93, 0x73, 0x0e, 0xa7, 0x5f, 0x3f, 0x38, 0xcd, 0x58, 0x5a, 0x6d, 0xe6,
0xee, 0x19, 0x2b, 0x2d, 0x8d, 0xc4, 0x23, 0x4a, 0xe3, 0x44, 0x67, 0x15, 0x17, 0x32, 0xa6, 0x05,
0x8f, 0xdd, 0x5d, 0xf8, 0x89, 0xc0, 0x7f, 0xb4, 0x88, 0xb0, 0x1d, 0xbe, 0x03, 0x3f, 0x6b, 0x70,
0x80, 0x66, 0x28, 0x1a, 0x2c, 0xce, 0xe2, 0x43, 0xae, 0xd8, 0x39, 0x1e, 0xa4, 0x58, 0x73, 0xab,
0x25, 0x7b, 0x17, 0xc6, 0xd0, 0xcd, 0x12, 0x93, 0x04, 0x9d, 0x19, 0x8a, 0xfe, 0x13, 0x87, 0xf1,
0x39, 0x0c, 0x4b, 0x26, 0xb2, 0x15, 0x17, 0x86, 0x69, 0x5d, 0x29, 0x13, 0xfc, 0x9d, 0xa1, 0xc8,
0x27, 0x27, 0x96, 0x5d, 0xb6, 0x64, 0xf8, 0x85, 0x60, 0xf8, 0x3b, 0x17, 0xdf, 0x82, 0xcf, 0x45,
0x69, 0x12, 0x41, 0x59, 0xd3, 0x67, 0x72, 0xb8, 0xcf, 0xb2, 0x51, 0x91, 0xbd, 0xde, 0x36, 0x59,
0xef, 0x52, 0xe1, 0x9a, 0xf4, 0x89, 0xc3, 0x78, 0x0a, 0x83, 0xf2, 0x9d, 0x19, 0x9a, 0xaf, 0x54,
0x62, 0x72, 0x57, 0xa3, 0x4f, 0xa0, 0xa6, 0x5e, 0x12, 0x93, 0x5b, 0x93, 0x92, 0xda, 0x04, 0xdd,
0xda, 0x64, 0x31, 0x0e, 0xa0, 0xf7, 0xc1, 0x74, 0x2a, 0x4b, 0x16, 0x78, 0xae, 0x77, 0x7b, 0xb4,
0x71, 0x7c, 0x6b, 0x35, 0xab, 0x35, 0x2f, 0x58, 0xd0, 0xab, 0xe3, 0x6a, 0xea, 0x89, 0x17, 0x2c,
0xbc, 0x81, 0x7e, 0x33, 0xdb, 0x52, 0xed, 0x47, 0x83, 0x7e, 0x8c, 0x66, 0x04, 0x1e, 0xd3, 0x5a,
0xea, 0xa6, 0x65, 0x7d, 0x08, 0xc7, 0xe0, 0xb7, 0x1f, 0x84, 0x87, 0xd0, 0xe1, 0x99, 0xf3, 0x78,
0xa4, 0xc3, 0xb3, 0xc5, 0x2b, 0x78, 0x2e, 0x12, 0x3f, 0xb7, 0x60, 0x72, 0xe4, 0x17, 0x11, 0xb6,
0x1b, 0x4f, 0x8f, 0xde, 0x97, 0x2a, 0xfc, 0x13, 0xa1, 0x2b, 0x74, 0x7f, 0xf1, 0x16, 0x6d, 0xb8,
0xc9, 0xab, 0x34, 0xa6, 0x72, 0x3b, 0x6f, 0xf4, 0xed, 0xfb, 0x92, 0x16, 0x7c, 0xae, 0x15, 0xad,
0x17, 0x2a, 0xfd, 0xe7, 0x36, 0xea, 0xfa, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x52, 0x1d, 0x1f,
0x66, 0x02, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
const _ = grpc.SupportPackageIsVersion6
// DebugClient is the client API for Debug service.
//
......@@ -295,10 +308,10 @@ type DebugClient interface {
}
type debugClient struct {
cc *grpc.ClientConn
cc grpc.ClientConnInterface
}
func NewDebugClient(cc *grpc.ClientConn) DebugClient {
func NewDebugClient(cc grpc.ClientConnInterface) DebugClient {
return &debugClient{cc}
}
......@@ -338,6 +351,14 @@ type DebugServer interface {
Debug(Debug_DebugServer) error
}
// UnimplementedDebugServer can be embedded to have forward compatible implementations.
type UnimplementedDebugServer struct {
}
func (*UnimplementedDebugServer) Debug(srv Debug_DebugServer) error {
return status.Errorf(codes.Unimplemented, "method Debug not implemented")
}
func RegisterDebugServer(s *grpc.Server, srv DebugServer) {
s.RegisterService(&_Debug_serviceDesc, srv)
}
......
......@@ -40,6 +40,9 @@ message DebugReq {
// The data to be sent to the target being monitored.
bytes data = 2;
// Set this to true to send and Interrupt signal to the debugger process
bool send_interrupt = 3;
}
message DebugConfigReq {
......
......@@ -9,6 +9,8 @@ import (
proto "github.com/golang/protobuf/proto"
_struct "github.com/golang/protobuf/ptypes/struct"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math"
)
......@@ -266,11 +268,11 @@ var fileDescriptor_94d5950496a7550d = []byte{
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
const _ = grpc.SupportPackageIsVersion6
// MonitorClient is the client API for Monitor service.
//
......@@ -280,10 +282,10 @@ type MonitorClient interface {
}
type monitorClient struct {
cc *grpc.ClientConn
cc grpc.ClientConnInterface
}
func NewMonitorClient(cc *grpc.ClientConn) MonitorClient {
func NewMonitorClient(cc grpc.ClientConnInterface) MonitorClient {
return &monitorClient{cc}
}
......@@ -323,6 +325,14 @@ type MonitorServer interface {
StreamingOpen(Monitor_StreamingOpenServer) error
}
// UnimplementedMonitorServer can be embedded to have forward compatible implementations.
type UnimplementedMonitorServer struct {
}
func (*UnimplementedMonitorServer) StreamingOpen(srv Monitor_StreamingOpenServer) error {
return status.Errorf(codes.Unimplemented, "method StreamingOpen not implemented")
}
func RegisterMonitorServer(s *grpc.Server, srv MonitorServer) {
s.RegisterService(&_Monitor_serviceDesc, srv)
}
......
......@@ -8,6 +8,8 @@ import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math"
)
......@@ -275,11 +277,11 @@ var fileDescriptor_a4bfd59e429426d0 = []byte{
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
const _ = grpc.SupportPackageIsVersion6
// SettingsClient is the client API for Settings service.
//
......@@ -292,10 +294,10 @@ type SettingsClient interface {
}
type settingsClient struct {
cc *grpc.ClientConn
cc grpc.ClientConnInterface
}
func NewSettingsClient(cc *grpc.ClientConn) SettingsClient {
func NewSettingsClient(cc grpc.ClientConnInterface) SettingsClient {
return &settingsClient{cc}
}
......@@ -343,6 +345,23 @@ type SettingsServer interface {
SetValue(context.Context, *Value) (*SetValueResponse, error)
}
// UnimplementedSettingsServer can be embedded to have forward compatible implementations.
type UnimplementedSettingsServer struct {
}
func (*UnimplementedSettingsServer) GetAll(ctx context.Context, req *GetAllRequest) (*RawData, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAll not implemented")
}
func (*UnimplementedSettingsServer) Merge(ctx context.Context, req *RawData) (*MergeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Merge not implemented")
}
func (*UnimplementedSettingsServer) GetValue(ctx context.Context, req *GetValueRequest) (*Value, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetValue not implemented")
}
func (*UnimplementedSettingsServer) SetValue(ctx context.Context, req *Value) (*SetValueResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetValue not implemented")
}
func RegisterSettingsServer(s *grpc.Server, srv SettingsServer) {
s.RegisterService(&_Settings_serviceDesc, srv)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment