diff --git a/Gopkg.lock b/Gopkg.lock index 0ea1a100a..5083251f7 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -716,6 +716,7 @@ "google.golang.org/grpc", "google.golang.org/grpc/codes", "google.golang.org/grpc/grpclog", + "google.golang.org/grpc/metadata", "google.golang.org/grpc/status", "gopkg.in/Masterminds/squirrel.v1", "gopkg.in/mail.v2", diff --git a/codegen.sh b/codegen.sh index 2725ca131..60280c296 100755 --- a/codegen.sh +++ b/codegen.sh @@ -160,16 +160,29 @@ function specs { function proto { yellow "> proto" + + CORTEZA_PROTOBUF_PATH=${CORTEZA_PROTOBUF_PATH:-"vendor/github.com/cortezaproject/corteza-protobuf"} + # Compose Proto Path + CPC="github.com/cortezaproject/corteza-server/compose/proto" + yellow " ${CORTEZA_PROTOBUF_PATH} >> compose/proto" PATH=$PATH:$GOPATH/bin protoc \ --proto_path ${CORTEZA_PROTOBUF_PATH}/compose \ - --go_out=plugins=grpc:compose/proto \ - namespace.proto \ - module.proto \ - record.proto \ - script_runner.proto + --go_out=./compose/proto \ + record.proto namespace.proto module.proto + + + assoc="${assoc},Mcompose/record.proto=${CPC}" + assoc="${assoc},Mcompose/module.proto=${CPC}" + assoc="${assoc},Mcompose/namespace.proto=${CPC}" + + yellow " ${CORTEZA_PROTOBUF_PATH} >> pkg/automation/corredor" + PATH=$PATH:$GOPATH/bin protoc \ + --proto_path ${CORTEZA_PROTOBUF_PATH} \ + --go_out="plugins=grpc${assoc}:./pkg/automation/corredor" \ + service-corredor.proto yellow " ${CORTEZA_PROTOBUF_PATH} >> system/proto" PATH=$PATH:$GOPATH/bin protoc \ diff --git a/compose/internal/service/automation_runner.go b/compose/internal/service/automation_runner.go index 44eac810f..292b0efaf 100644 --- a/compose/internal/service/automation_runner.go +++ b/compose/internal/service/automation_runner.go @@ -14,6 +14,7 @@ import ( "github.com/cortezaproject/corteza-server/compose/types" "github.com/cortezaproject/corteza-server/internal/auth" "github.com/cortezaproject/corteza-server/pkg/automation" + "github.com/cortezaproject/corteza-server/pkg/automation/corredor" "github.com/cortezaproject/corteza-server/pkg/sentry" ) @@ -22,7 +23,7 @@ type ( opt AutomationRunnerOpt ac automationRunnerAccessControler logger *zap.Logger - runner proto.ScriptRunnerClient + runner corredor.ScriptRunnerClient scriptFinder automationScriptsFinder jwtEncoder auth.TokenEncoder } @@ -47,7 +48,7 @@ const ( AutomationResourceRecord = "compose:record" ) -func AutomationRunner(opt AutomationRunnerOpt, f automationScriptsFinder, r proto.ScriptRunnerClient) automationRunner { +func AutomationRunner(opt AutomationRunnerOpt, f automationScriptsFinder, r corredor.ScriptRunnerClient) automationRunner { var svc = automationRunner{ opt: opt, @@ -219,7 +220,7 @@ func (svc automationRunner) RecordScriptTester(ctx context.Context, source strin // func (svc automationRunner) makeRecordScriptRunner(ctx context.Context, ns *types.Namespace, m *types.Module, r *types.Record, discard bool) func(script *automation.Script) error { // Static request params (record gets updated - var req = &proto.RunRecordRequest{ + var req = &corredor.RunRecordRequest{ Namespace: proto.FromNamespace(ns), Module: proto.FromModule(m), Record: proto.FromRecord(r), @@ -250,7 +251,7 @@ func (svc automationRunner) makeRecordScriptRunner(ctx context.Context, ns *type } // Add script info - req.Script = proto.FromAutomationScript(script) + req.Script = corredor.FromScript(script) rsp, err := svc.runner.Record(ctx, req, grpc.WaitForReady(script.Critical)) diff --git a/compose/internal/service/service.go b/compose/internal/service/service.go index bee3dced5..6ffce0834 100644 --- a/compose/internal/service/service.go +++ b/compose/internal/service/service.go @@ -7,13 +7,13 @@ import ( "go.uber.org/zap" "github.com/cortezaproject/corteza-server/compose/internal/repository" - "github.com/cortezaproject/corteza-server/compose/proto" "github.com/cortezaproject/corteza-server/internal/auth" "github.com/cortezaproject/corteza-server/internal/permissions" "github.com/cortezaproject/corteza-server/internal/store" "github.com/cortezaproject/corteza-server/pkg/automation" + "github.com/cortezaproject/corteza-server/pkg/automation/corredor" "github.com/cortezaproject/corteza-server/pkg/cli/options" - proto2 "github.com/cortezaproject/corteza-server/system/proto" + systemProto "github.com/cortezaproject/corteza-server/system/proto" ) type ( @@ -84,7 +84,7 @@ func Init(ctx context.Context, log *zap.Logger, c Config) (err error) { return err } - DefaultSystemUser = SystemUser(proto2.NewUsersClient(systemClientConn)) + DefaultSystemUser = SystemUser(systemProto.NewUsersClient(systemClientConn)) } // ias: Internal Automatinon Service @@ -104,17 +104,17 @@ func Init(ctx context.Context, log *zap.Logger, c Config) (err error) { DefaultAutomationTriggerManager = AutomationTrigger(ias) { - var scriptRunnerClient proto.ScriptRunnerClient + var scriptRunnerClient corredor.ScriptRunnerClient if c.Corredor.Enabled { - corredor, err := automation.Corredor(ctx, c.Corredor, DefaultLogger) + conn, err := corredor.NewConnection(ctx, c.Corredor, DefaultLogger) log.Info("initializing corredor connection", zap.String("addr", c.Corredor.Addr), zap.Error(err)) if err != nil { return err } - scriptRunnerClient = proto.NewScriptRunnerClient(corredor) + scriptRunnerClient = corredor.NewScriptRunnerClient(conn) } DefaultAutomationRunner = AutomationRunner( diff --git a/compose/proto/module.go b/compose/proto/module.go new file mode 100644 index 000000000..b4d9bd123 --- /dev/null +++ b/compose/proto/module.go @@ -0,0 +1,31 @@ +package proto + +import ( + "github.com/cortezaproject/corteza-server/compose/types" +) + +func FromModule(i *types.Module) *Module { + if i == nil { + return nil + } + + var p = &Module{ + ModuleID: i.ID, + NamespaceID: i.NamespaceID, + Name: i.Name, + CreatedAt: fromTime(i.CreatedAt), + UpdatedAt: fromTime(i.UpdatedAt), + DeletedAt: fromTime(i.DeletedAt), + Fields: make([]*ModuleField, len(i.Fields)), + } + + for f := range i.Fields { + p.Fields[f] = &ModuleField{ + FieldID: i.Fields[f].ID, + Name: i.Fields[f].Name, + Kind: i.Fields[f].Kind, + } + } + + return p +} diff --git a/compose/proto/namespace.go b/compose/proto/namespace.go new file mode 100644 index 000000000..4583d6bf6 --- /dev/null +++ b/compose/proto/namespace.go @@ -0,0 +1,23 @@ +package proto + +import ( + "github.com/cortezaproject/corteza-server/compose/types" +) + +func FromNamespace(i *types.Namespace) *Namespace { + if i == nil { + return nil + } + + var p = &Namespace{ + NamespaceID: i.ID, + Name: i.Name, + Slug: i.Slug, + Enabled: i.Enabled, + CreatedAt: fromTime(i.CreatedAt), + UpdatedAt: fromTime(i.UpdatedAt), + DeletedAt: fromTime(i.DeletedAt), + } + + return p +} diff --git a/compose/proto/from_proto.go b/compose/proto/record.go similarity index 65% rename from compose/proto/from_proto.go rename to compose/proto/record.go index f97e83e9a..0c6d9f9fc 100644 --- a/compose/proto/from_proto.go +++ b/compose/proto/record.go @@ -49,3 +49,32 @@ func toTimePtr(ts *timestamp.Timestamp) *time.Time { var t = toTime(ts) return &t } + +func FromRecord(i *types.Record) *Record { + if i == nil { + return nil + } + + var p = &Record{ + RecordID: i.ID, + ModuleID: i.ModuleID, + NamespaceID: i.NamespaceID, + OwnedBy: i.OwnedBy, + CreatedBy: i.CreatedBy, + UpdatedBy: i.UpdatedBy, + DeletedBy: i.DeletedBy, + CreatedAt: fromTime(i.CreatedAt), + UpdatedAt: fromTime(i.UpdatedAt), + DeletedAt: fromTime(i.DeletedAt), + Values: make([]*RecordValue, len(i.Values)), + } + + for v := range i.Values { + p.Values[v] = &RecordValue{ + Value: i.Values[v].Value, + Name: i.Values[v].Name, + } + } + + return p +} diff --git a/compose/proto/time.go b/compose/proto/time.go new file mode 100644 index 000000000..2555eb708 --- /dev/null +++ b/compose/proto/time.go @@ -0,0 +1,24 @@ +package proto + +import ( + "time" + + "github.com/golang/protobuf/ptypes/timestamp" +) + +// Converts time.Time (ptr AND value) to *timestamp.Timestamp +// +// Intentionally ignoring +func fromTime(i interface{}) *timestamp.Timestamp { + switch t := i.(type) { + case *time.Time: + if t == nil { + return nil + } + return ×tamp.Timestamp{Seconds: t.Unix(), Nanos: int32(t.Nanosecond())} + case time.Time: + return ×tamp.Timestamp{Seconds: t.Unix(), Nanos: int32(t.Nanosecond())} + default: + return nil + } +} diff --git a/compose/proto/to_proto.go b/compose/proto/to_proto.go deleted file mode 100644 index 3c3c64f2d..000000000 --- a/compose/proto/to_proto.go +++ /dev/null @@ -1,118 +0,0 @@ -package proto - -import ( - "time" - - "github.com/golang/protobuf/ptypes/timestamp" - - "github.com/cortezaproject/corteza-server/compose/types" - "github.com/cortezaproject/corteza-server/pkg/automation" -) - -type ( - Runnable interface { - IsAsync() bool - GetName() string - GetSource() string - GetTimeout() uint32 - } -) - -func FromRecord(i *types.Record) *Record { - if i == nil { - return nil - } - - var p = &Record{ - RecordID: i.ID, - ModuleID: i.ModuleID, - NamespaceID: i.NamespaceID, - OwnedBy: i.OwnedBy, - CreatedBy: i.CreatedBy, - UpdatedBy: i.UpdatedBy, - DeletedBy: i.DeletedBy, - CreatedAt: fromTime(i.CreatedAt), - UpdatedAt: fromTime(i.UpdatedAt), - DeletedAt: fromTime(i.DeletedAt), - Values: make([]*RecordValue, len(i.Values)), - } - - for v := range i.Values { - p.Values[v] = &RecordValue{ - Value: i.Values[v].Value, - Name: i.Values[v].Name, - } - } - - return p -} - -func FromModule(i *types.Module) *Module { - if i == nil { - return nil - } - - var p = &Module{ - ModuleID: i.ID, - NamespaceID: i.NamespaceID, - Name: i.Name, - CreatedAt: fromTime(i.CreatedAt), - UpdatedAt: fromTime(i.UpdatedAt), - DeletedAt: fromTime(i.DeletedAt), - Fields: make([]*ModuleField, len(i.Fields)), - } - - for f := range i.Fields { - p.Fields[f] = &ModuleField{ - FieldID: i.Fields[f].ID, - Name: i.Fields[f].Name, - Kind: i.Fields[f].Kind, - } - } - - return p -} - -func FromNamespace(i *types.Namespace) *Namespace { - if i == nil { - return nil - } - - var p = &Namespace{ - NamespaceID: i.ID, - Name: i.Name, - Slug: i.Slug, - Enabled: i.Enabled, - CreatedAt: fromTime(i.CreatedAt), - UpdatedAt: fromTime(i.UpdatedAt), - DeletedAt: fromTime(i.DeletedAt), - } - - return p -} - -func FromAutomationScript(s *automation.Script) *Script { - return &Script{ - Source: s.Source, - Name: s.Name, - Timeout: uint32(s.Timeout), - Async: s.Async, - } -} - -// Converts time.Time (ptr AND value) to *timestamp.Timestamp -// -// Intentionally ignoring -func fromTime(i interface{}) *timestamp.Timestamp { - switch t := i.(type) { - case *time.Time: - if t == nil { - return nil - } - return ×tamp.Timestamp{Seconds: t.Unix(), Nanos: int32(t.Nanosecond())} - case time.Time: - return ×tamp.Timestamp{Seconds: t.Unix(), Nanos: int32(t.Nanosecond())} - default: - return nil - } -} diff --git a/pkg/automation/corredor.go b/pkg/automation/corredor/conn.go similarity index 84% rename from pkg/automation/corredor.go rename to pkg/automation/corredor/conn.go index 4caa2c37f..cd75874c3 100644 --- a/pkg/automation/corredor.go +++ b/pkg/automation/corredor/conn.go @@ -1,4 +1,4 @@ -package automation +package corredor import ( "context" @@ -12,7 +12,7 @@ import ( ) // Corredor standard connector to Corredor service via gRPC -func Corredor(ctx context.Context, opt options.CorredorOpt, logger *zap.Logger) (c *grpc.ClientConn, err error) { +func NewConnection(ctx context.Context, opt options.CorredorOpt, logger *zap.Logger) (c *grpc.ClientConn, err error) { if !opt.Enabled { // Do not connect when script runner is not enabled return diff --git a/pkg/automation/corredor/script.go b/pkg/automation/corredor/script.go new file mode 100644 index 000000000..9d058ba93 --- /dev/null +++ b/pkg/automation/corredor/script.go @@ -0,0 +1,23 @@ +package corredor + +import ( + "github.com/cortezaproject/corteza-server/pkg/automation" +) + +type ( + Runnable interface { + IsAsync() bool + GetName() string + GetSource() string + GetTimeout() uint32 + } +) + +func FromScript(s *automation.Script) *Script { + return &Script{ + Source: s.Source, + Name: s.Name, + Timeout: uint32(s.Timeout), + Async: s.Async, + } +} diff --git a/compose/proto/script_runner.pb.go b/pkg/automation/corredor/service-corredor.pb.go similarity index 74% rename from compose/proto/script_runner.pb.go rename to pkg/automation/corredor/service-corredor.pb.go index 10ebff23d..16dbdab67 100644 --- a/compose/proto/script_runner.pb.go +++ b/pkg/automation/corredor/service-corredor.pb.go @@ -1,11 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: script_runner.proto +// source: service-corredor.proto -package proto +package corredor import ( context "context" fmt "fmt" + proto1 "github.com/cortezaproject/corteza-server/compose/proto" proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -36,7 +37,7 @@ func (m *RunTestRequest) Reset() { *m = RunTestRequest{} } func (m *RunTestRequest) String() string { return proto.CompactTextString(m) } func (*RunTestRequest) ProtoMessage() {} func (*RunTestRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_62210b9e3e4a7a06, []int{0} + return fileDescriptor_c06bb92bf45e37e2, []int{0} } func (m *RunTestRequest) XXX_Unmarshal(b []byte) error { @@ -74,7 +75,7 @@ func (m *RunTestRequest) GetName() string { type RunNamespaceRequest struct { Config map[string]string `protobuf:"bytes,1,rep,name=config,proto3" json:"config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Script *Script `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"` - Namespace *Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` + Namespace *proto1.Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -84,7 +85,7 @@ func (m *RunNamespaceRequest) Reset() { *m = RunNamespaceRequest{} } func (m *RunNamespaceRequest) String() string { return proto.CompactTextString(m) } func (*RunNamespaceRequest) ProtoMessage() {} func (*RunNamespaceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_62210b9e3e4a7a06, []int{1} + return fileDescriptor_c06bb92bf45e37e2, []int{1} } func (m *RunNamespaceRequest) XXX_Unmarshal(b []byte) error { @@ -119,7 +120,7 @@ func (m *RunNamespaceRequest) GetScript() *Script { return nil } -func (m *RunNamespaceRequest) GetNamespace() *Namespace { +func (m *RunNamespaceRequest) GetNamespace() *proto1.Namespace { if m != nil { return m.Namespace } @@ -129,8 +130,8 @@ func (m *RunNamespaceRequest) GetNamespace() *Namespace { type RunModuleRequest struct { Config map[string]string `protobuf:"bytes,1,rep,name=config,proto3" json:"config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Script *Script `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"` - Namespace *Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` - Module *Module `protobuf:"bytes,4,opt,name=module,proto3" json:"module,omitempty"` + Namespace *proto1.Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` + Module *proto1.Module `protobuf:"bytes,4,opt,name=module,proto3" json:"module,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -140,7 +141,7 @@ func (m *RunModuleRequest) Reset() { *m = RunModuleRequest{} } func (m *RunModuleRequest) String() string { return proto.CompactTextString(m) } func (*RunModuleRequest) ProtoMessage() {} func (*RunModuleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_62210b9e3e4a7a06, []int{2} + return fileDescriptor_c06bb92bf45e37e2, []int{2} } func (m *RunModuleRequest) XXX_Unmarshal(b []byte) error { @@ -175,14 +176,14 @@ func (m *RunModuleRequest) GetScript() *Script { return nil } -func (m *RunModuleRequest) GetNamespace() *Namespace { +func (m *RunModuleRequest) GetNamespace() *proto1.Namespace { if m != nil { return m.Namespace } return nil } -func (m *RunModuleRequest) GetModule() *Module { +func (m *RunModuleRequest) GetModule() *proto1.Module { if m != nil { return m.Module } @@ -192,9 +193,9 @@ func (m *RunModuleRequest) GetModule() *Module { type RunRecordRequest struct { Config map[string]string `protobuf:"bytes,1,rep,name=config,proto3" json:"config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Script *Script `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"` - Namespace *Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` - Module *Module `protobuf:"bytes,4,opt,name=module,proto3" json:"module,omitempty"` - Record *Record `protobuf:"bytes,5,opt,name=record,proto3" json:"record,omitempty"` + Namespace *proto1.Namespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` + Module *proto1.Module `protobuf:"bytes,4,opt,name=module,proto3" json:"module,omitempty"` + Record *proto1.Record `protobuf:"bytes,5,opt,name=record,proto3" json:"record,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -204,7 +205,7 @@ func (m *RunRecordRequest) Reset() { *m = RunRecordRequest{} } func (m *RunRecordRequest) String() string { return proto.CompactTextString(m) } func (*RunRecordRequest) ProtoMessage() {} func (*RunRecordRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_62210b9e3e4a7a06, []int{3} + return fileDescriptor_c06bb92bf45e37e2, []int{3} } func (m *RunRecordRequest) XXX_Unmarshal(b []byte) error { @@ -239,21 +240,21 @@ func (m *RunRecordRequest) GetScript() *Script { return nil } -func (m *RunRecordRequest) GetNamespace() *Namespace { +func (m *RunRecordRequest) GetNamespace() *proto1.Namespace { if m != nil { return m.Namespace } return nil } -func (m *RunRecordRequest) GetModule() *Module { +func (m *RunRecordRequest) GetModule() *proto1.Module { if m != nil { return m.Module } return nil } -func (m *RunRecordRequest) GetRecord() *Record { +func (m *RunRecordRequest) GetRecord() *proto1.Record { if m != nil { return m.Record } @@ -270,7 +271,7 @@ func (m *RunTestResponse) Reset() { *m = RunTestResponse{} } func (m *RunTestResponse) String() string { return proto.CompactTextString(m) } func (*RunTestResponse) ProtoMessage() {} func (*RunTestResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_62210b9e3e4a7a06, []int{4} + return fileDescriptor_c06bb92bf45e37e2, []int{4} } func (m *RunTestResponse) XXX_Unmarshal(b []byte) error { @@ -292,17 +293,17 @@ func (m *RunTestResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RunTestResponse proto.InternalMessageInfo type RunNamespaceResponse struct { - Namespace *Namespace `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Namespace *proto1.Namespace `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RunNamespaceResponse) Reset() { *m = RunNamespaceResponse{} } func (m *RunNamespaceResponse) String() string { return proto.CompactTextString(m) } func (*RunNamespaceResponse) ProtoMessage() {} func (*RunNamespaceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_62210b9e3e4a7a06, []int{5} + return fileDescriptor_c06bb92bf45e37e2, []int{5} } func (m *RunNamespaceResponse) XXX_Unmarshal(b []byte) error { @@ -323,7 +324,7 @@ func (m *RunNamespaceResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RunNamespaceResponse proto.InternalMessageInfo -func (m *RunNamespaceResponse) GetNamespace() *Namespace { +func (m *RunNamespaceResponse) GetNamespace() *proto1.Namespace { if m != nil { return m.Namespace } @@ -331,17 +332,17 @@ func (m *RunNamespaceResponse) GetNamespace() *Namespace { } type RunModuleResponse struct { - Module *Module `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Module *proto1.Module `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RunModuleResponse) Reset() { *m = RunModuleResponse{} } func (m *RunModuleResponse) String() string { return proto.CompactTextString(m) } func (*RunModuleResponse) ProtoMessage() {} func (*RunModuleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_62210b9e3e4a7a06, []int{6} + return fileDescriptor_c06bb92bf45e37e2, []int{6} } func (m *RunModuleResponse) XXX_Unmarshal(b []byte) error { @@ -362,7 +363,7 @@ func (m *RunModuleResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RunModuleResponse proto.InternalMessageInfo -func (m *RunModuleResponse) GetModule() *Module { +func (m *RunModuleResponse) GetModule() *proto1.Module { if m != nil { return m.Module } @@ -370,17 +371,17 @@ func (m *RunModuleResponse) GetModule() *Module { } type RunRecordResponse struct { - Record *Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Record *proto1.Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *RunRecordResponse) Reset() { *m = RunRecordResponse{} } func (m *RunRecordResponse) String() string { return proto.CompactTextString(m) } func (*RunRecordResponse) ProtoMessage() {} func (*RunRecordResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_62210b9e3e4a7a06, []int{7} + return fileDescriptor_c06bb92bf45e37e2, []int{7} } func (m *RunRecordResponse) XXX_Unmarshal(b []byte) error { @@ -401,7 +402,7 @@ func (m *RunRecordResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RunRecordResponse proto.InternalMessageInfo -func (m *RunRecordResponse) GetRecord() *Record { +func (m *RunRecordResponse) GetRecord() *proto1.Record { if m != nil { return m.Record } @@ -422,7 +423,7 @@ func (m *Script) Reset() { *m = Script{} } func (m *Script) String() string { return proto.CompactTextString(m) } func (*Script) ProtoMessage() {} func (*Script) Descriptor() ([]byte, []int) { - return fileDescriptor_62210b9e3e4a7a06, []int{8} + return fileDescriptor_c06bb92bf45e37e2, []int{8} } func (m *Script) XXX_Unmarshal(b []byte) error { @@ -472,55 +473,55 @@ func (m *Script) GetAsync() bool { } func init() { - proto.RegisterType((*RunTestRequest)(nil), "compose.RunTestRequest") - proto.RegisterType((*RunNamespaceRequest)(nil), "compose.RunNamespaceRequest") - proto.RegisterMapType((map[string]string)(nil), "compose.RunNamespaceRequest.ConfigEntry") - proto.RegisterType((*RunModuleRequest)(nil), "compose.RunModuleRequest") - proto.RegisterMapType((map[string]string)(nil), "compose.RunModuleRequest.ConfigEntry") - proto.RegisterType((*RunRecordRequest)(nil), "compose.RunRecordRequest") - proto.RegisterMapType((map[string]string)(nil), "compose.RunRecordRequest.ConfigEntry") - proto.RegisterType((*RunTestResponse)(nil), "compose.RunTestResponse") - proto.RegisterType((*RunNamespaceResponse)(nil), "compose.RunNamespaceResponse") - proto.RegisterType((*RunModuleResponse)(nil), "compose.RunModuleResponse") - proto.RegisterType((*RunRecordResponse)(nil), "compose.RunRecordResponse") - proto.RegisterType((*Script)(nil), "compose.Script") + proto.RegisterType((*RunTestRequest)(nil), "corredor.RunTestRequest") + proto.RegisterType((*RunNamespaceRequest)(nil), "corredor.RunNamespaceRequest") + proto.RegisterMapType((map[string]string)(nil), "corredor.RunNamespaceRequest.ConfigEntry") + proto.RegisterType((*RunModuleRequest)(nil), "corredor.RunModuleRequest") + proto.RegisterMapType((map[string]string)(nil), "corredor.RunModuleRequest.ConfigEntry") + proto.RegisterType((*RunRecordRequest)(nil), "corredor.RunRecordRequest") + proto.RegisterMapType((map[string]string)(nil), "corredor.RunRecordRequest.ConfigEntry") + proto.RegisterType((*RunTestResponse)(nil), "corredor.RunTestResponse") + proto.RegisterType((*RunNamespaceResponse)(nil), "corredor.RunNamespaceResponse") + proto.RegisterType((*RunModuleResponse)(nil), "corredor.RunModuleResponse") + proto.RegisterType((*RunRecordResponse)(nil), "corredor.RunRecordResponse") + proto.RegisterType((*Script)(nil), "corredor.Script") } -func init() { proto.RegisterFile("script_runner.proto", fileDescriptor_62210b9e3e4a7a06) } +func init() { proto.RegisterFile("service-corredor.proto", fileDescriptor_c06bb92bf45e37e2) } -var fileDescriptor_62210b9e3e4a7a06 = []byte{ - // 483 bytes of a gzipped FileDescriptorProto +var fileDescriptor_c06bb92bf45e37e2 = []byte{ + // 492 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xdd, 0x8a, 0x13, 0x31, - 0x14, 0x26, 0xd3, 0x76, 0x6a, 0x4f, 0x57, 0xbb, 0x9b, 0x5d, 0x34, 0x0e, 0x0a, 0xcb, 0x80, 0xd8, - 0xab, 0x41, 0xea, 0x8d, 0x2b, 0x2b, 0x8a, 0x22, 0xec, 0x8d, 0x5e, 0x44, 0xaf, 0xbc, 0x91, 0x71, - 0x1a, 0xa5, 0xd8, 0x49, 0xc6, 0x64, 0x22, 0xf4, 0x2d, 0xbc, 0xf1, 0x61, 0x7c, 0x28, 0xdf, 0x41, - 0x26, 0xc9, 0xfc, 0xa4, 0xb6, 0xa5, 0x52, 0x90, 0xbd, 0x9a, 0x39, 0x39, 0x5f, 0xbe, 0xe4, 0xfb, - 0x4e, 0xce, 0x81, 0x53, 0x95, 0xc9, 0x45, 0x51, 0x7e, 0x94, 0x9a, 0x73, 0x26, 0x93, 0x42, 0x8a, - 0x52, 0xe0, 0x61, 0x26, 0xf2, 0x42, 0x28, 0x16, 0x4d, 0x78, 0x9a, 0x33, 0x55, 0xa4, 0x19, 0xb3, - 0x99, 0xe8, 0x28, 0x17, 0x73, 0xbd, 0x6c, 0x22, 0xc9, 0x32, 0x21, 0xe7, 0x36, 0x8a, 0x2f, 0xe1, - 0x16, 0xd5, 0xfc, 0x3d, 0x53, 0x25, 0x65, 0xdf, 0x34, 0x53, 0x25, 0xbe, 0x0d, 0xa1, 0x12, 0x5a, - 0x66, 0x8c, 0xa0, 0x73, 0x34, 0x1d, 0x51, 0x17, 0x61, 0x0c, 0xfd, 0x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xc2, 0x08, 0xc1, + 0x15, 0x7e, 0x01, 0x83, 0x5a, 0x4c, 0x4c, 0xa2, 0x81, 0x5b, 0x3b, 0x71, 0xe9, 0xad, 0x0d, 0x11, + 0x4f, 0xee, 0x2d, 0x0c, 0x1b, 0x1d, 0xf1, 0x9d, 0xad, 0x67, 0x2b, 0xbd, 0x7b, 0x51, 0xd8, 0xe7, + 0x3a, 0x85, 0xc4, 0xe9, 0x89, 0xd3, 0x8b, 0x0f, 0x42, 0x7a, 0x7b, 0x63, 0xac, 0x4d, 0xe1, 0x44, + 0xed, 0xa4, 0x88, 0xd6, 0xa7, 0x93, 0x22, 0x6e, 0xd7, 0xa7, 0xc4, 0x1e, 0xfa, 0x27, 0xbf, 0x03, + 0x00, 0x00, 0xff, 0xff, 0x72, 0x3d, 0x15, 0x27, 0x51, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -551,7 +552,7 @@ func NewScriptRunnerClient(cc *grpc.ClientConn) ScriptRunnerClient { func (c *scriptRunnerClient) Test(ctx context.Context, in *RunTestRequest, opts ...grpc.CallOption) (*RunTestResponse, error) { out := new(RunTestResponse) - err := c.cc.Invoke(ctx, "/compose.ScriptRunner/Test", in, out, opts...) + err := c.cc.Invoke(ctx, "/corredor.ScriptRunner/Test", in, out, opts...) if err != nil { return nil, err } @@ -560,7 +561,7 @@ func (c *scriptRunnerClient) Test(ctx context.Context, in *RunTestRequest, opts func (c *scriptRunnerClient) Namespace(ctx context.Context, in *RunNamespaceRequest, opts ...grpc.CallOption) (*RunNamespaceResponse, error) { out := new(RunNamespaceResponse) - err := c.cc.Invoke(ctx, "/compose.ScriptRunner/Namespace", in, out, opts...) + err := c.cc.Invoke(ctx, "/corredor.ScriptRunner/Namespace", in, out, opts...) if err != nil { return nil, err } @@ -569,7 +570,7 @@ func (c *scriptRunnerClient) Namespace(ctx context.Context, in *RunNamespaceRequ func (c *scriptRunnerClient) Module(ctx context.Context, in *RunModuleRequest, opts ...grpc.CallOption) (*RunModuleResponse, error) { out := new(RunModuleResponse) - err := c.cc.Invoke(ctx, "/compose.ScriptRunner/Module", in, out, opts...) + err := c.cc.Invoke(ctx, "/corredor.ScriptRunner/Module", in, out, opts...) if err != nil { return nil, err } @@ -578,7 +579,7 @@ func (c *scriptRunnerClient) Module(ctx context.Context, in *RunModuleRequest, o func (c *scriptRunnerClient) Record(ctx context.Context, in *RunRecordRequest, opts ...grpc.CallOption) (*RunRecordResponse, error) { out := new(RunRecordResponse) - err := c.cc.Invoke(ctx, "/compose.ScriptRunner/Record", in, out, opts...) + err := c.cc.Invoke(ctx, "/corredor.ScriptRunner/Record", in, out, opts...) if err != nil { return nil, err } @@ -624,7 +625,7 @@ func _ScriptRunner_Test_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/compose.ScriptRunner/Test", + FullMethod: "/corredor.ScriptRunner/Test", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ScriptRunnerServer).Test(ctx, req.(*RunTestRequest)) @@ -642,7 +643,7 @@ func _ScriptRunner_Namespace_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/compose.ScriptRunner/Namespace", + FullMethod: "/corredor.ScriptRunner/Namespace", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ScriptRunnerServer).Namespace(ctx, req.(*RunNamespaceRequest)) @@ -660,7 +661,7 @@ func _ScriptRunner_Module_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/compose.ScriptRunner/Module", + FullMethod: "/corredor.ScriptRunner/Module", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ScriptRunnerServer).Module(ctx, req.(*RunModuleRequest)) @@ -678,7 +679,7 @@ func _ScriptRunner_Record_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/compose.ScriptRunner/Record", + FullMethod: "/corredor.ScriptRunner/Record", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ScriptRunnerServer).Record(ctx, req.(*RunRecordRequest)) @@ -687,7 +688,7 @@ func _ScriptRunner_Record_Handler(srv interface{}, ctx context.Context, dec func } var _ScriptRunner_serviceDesc = grpc.ServiceDesc{ - ServiceName: "compose.ScriptRunner", + ServiceName: "corredor.ScriptRunner", HandlerType: (*ScriptRunnerServer)(nil), Methods: []grpc.MethodDesc{ { @@ -708,5 +709,5 @@ var _ScriptRunner_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "script_runner.proto", + Metadata: "service-corredor.proto", } diff --git a/system/system.go b/system/system.go index 7c8447561..372da1f35 100644 --- a/system/system.go +++ b/system/system.go @@ -79,6 +79,7 @@ func Configure() *cli.Config { ) // Temporary gRPC server initialization location + // @todo move out of system Configure grpcServer := grpc.NewServer() ln, err := net.Listen(c.GRPCServerSystem.Network, c.GRPCServerSystem.Addr)