diff --git a/.gitignore b/.gitignore index 056ffb8..e0227fe 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ fabric.properties .gitignore .idea/ +*.iml \ No newline at end of file diff --git a/data/cmd b/data/cmd new file mode 100644 index 0000000..83b569d --- /dev/null +++ b/data/cmd @@ -0,0 +1 @@ +protoc -I data/ data/data.proto --go_out=plugins=grpc:data \ No newline at end of file diff --git a/data/data.pb.go b/data/data.pb.go new file mode 100644 index 0000000..5d7097e --- /dev/null +++ b/data/data.pb.go @@ -0,0 +1,222 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: data.proto + +/* +Package data is a generated protocol buffer package. + +It is generated from these files: + data.proto + +It has these top-level messages: + Empty + CollectedData +*/ +package data + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Empty struct { +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type CollectedData struct { + AgentId string `protobuf:"bytes,1,opt,name=agentId" json:"agentId,omitempty"` + SensorId string `protobuf:"bytes,2,opt,name=sensorId" json:"sensorId,omitempty"` + Data map[string]string `protobuf:"bytes,3,rep,name=data" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + StartDate int64 `protobuf:"varint,4,opt,name=startDate" json:"startDate,omitempty"` + FinishDate int64 `protobuf:"varint,5,opt,name=finishDate" json:"finishDate,omitempty"` +} + +func (m *CollectedData) Reset() { *m = CollectedData{} } +func (m *CollectedData) String() string { return proto.CompactTextString(m) } +func (*CollectedData) ProtoMessage() {} +func (*CollectedData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *CollectedData) GetAgentId() string { + if m != nil { + return m.AgentId + } + return "" +} + +func (m *CollectedData) GetSensorId() string { + if m != nil { + return m.SensorId + } + return "" +} + +func (m *CollectedData) GetData() map[string]string { + if m != nil { + return m.Data + } + return nil +} + +func (m *CollectedData) GetStartDate() int64 { + if m != nil { + return m.StartDate + } + return 0 +} + +func (m *CollectedData) GetFinishDate() int64 { + if m != nil { + return m.FinishDate + } + return 0 +} + +func init() { + proto.RegisterType((*Empty)(nil), "Empty") + proto.RegisterType((*CollectedData)(nil), "CollectedData") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// 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 + +// Client API for Data service + +type DataClient interface { + SendMetric(ctx context.Context, in *CollectedData, opts ...grpc.CallOption) (*Empty, error) + SendMeta(ctx context.Context, in *CollectedData, opts ...grpc.CallOption) (*Empty, error) +} + +type dataClient struct { + cc *grpc.ClientConn +} + +func NewDataClient(cc *grpc.ClientConn) DataClient { + return &dataClient{cc} +} + +func (c *dataClient) SendMetric(ctx context.Context, in *CollectedData, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := grpc.Invoke(ctx, "/Data/sendMetric", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dataClient) SendMeta(ctx context.Context, in *CollectedData, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := grpc.Invoke(ctx, "/Data/sendMeta", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Data service + +type DataServer interface { + SendMetric(context.Context, *CollectedData) (*Empty, error) + SendMeta(context.Context, *CollectedData) (*Empty, error) +} + +func RegisterDataServer(s *grpc.Server, srv DataServer) { + s.RegisterService(&_Data_serviceDesc, srv) +} + +func _Data_SendMetric_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CollectedData) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DataServer).SendMetric(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Data/SendMetric", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DataServer).SendMetric(ctx, req.(*CollectedData)) + } + return interceptor(ctx, in, info, handler) +} + +func _Data_SendMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CollectedData) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DataServer).SendMeta(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Data/SendMeta", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DataServer).SendMeta(ctx, req.(*CollectedData)) + } + return interceptor(ctx, in, info, handler) +} + +var _Data_serviceDesc = grpc.ServiceDesc{ + ServiceName: "Data", + HandlerType: (*DataServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "sendMetric", + Handler: _Data_SendMetric_Handler, + }, + { + MethodName: "sendMeta", + Handler: _Data_SendMeta_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "data.proto", +} + +func init() { proto.RegisterFile("data.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 244 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x50, 0xc1, 0x4a, 0xc3, 0x40, + 0x14, 0x74, 0x9b, 0xa4, 0x35, 0x4f, 0x14, 0x79, 0x78, 0x58, 0x82, 0x48, 0x28, 0x22, 0x39, 0x48, + 0x0e, 0xf5, 0xa0, 0x78, 0xb5,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 0xee, 0x75, 0xb4, + 0x5f, 0xf5, 0x3c, 0x0e, 0x93, 0xde, 0xfc, 0x04, 0x00, 0x00, 0xff, 0xff, 0x16, 0x7f, 0xaf, 0xb1, + 0x60, 0x01, 0x00, 0x00, +} diff --git a/event/event.pb.go b/event/event.pb.go new file mode 100644 index 0000000..9bab962 --- /dev/null +++ b/event/event.pb.go @@ -0,0 +1,634 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: event.proto + +/* +Package event is a generated protocol buffer package. + +It is generated from these files: + event.proto + +It has these top-level messages: + Empty + DiscoveryEvent + TaskResultEvent + AgentEvent +*/ +package event + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type TaskResultState int32 + +const ( + TaskResultState_FAILED TaskResultState = 0 + TaskResultState_SUCCEED TaskResultState = 1 + TaskResultState_PROCEEDING TaskResultState = 2 +) + +var TaskResultState_name = map[int32]string{ + 0: "FAILED", + 1: "SUCCEED", + 2: "PROCEEDING", +} +var TaskResultState_value = map[string]int32{ + "FAILED": 0, + "SUCCEED": 1, + "PROCEEDING": 2, +} + +func (x TaskResultState) String() string { + return proto.EnumName(TaskResultState_name, int32(x)) +} +func (TaskResultState) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type DiscoveryEvent_DiscoveryEventType int32 + +const ( + DiscoveryEvent_DISCOVERY_START DiscoveryEvent_DiscoveryEventType = 0 + DiscoveryEvent_DISCOVERY_HOST_START DiscoveryEvent_DiscoveryEventType = 1 + DiscoveryEvent_DISCOVERY_HOST_FOUND DiscoveryEvent_DiscoveryEventType = 2 + DiscoveryEvent_DISCOVERY_HOST_DONE DiscoveryEvent_DiscoveryEventType = 3 + DiscoveryEvent_DISCOVERY_PORT_START DiscoveryEvent_DiscoveryEventType = 4 + DiscoveryEvent_DISCOVERY_PORT_FOUND DiscoveryEvent_DiscoveryEventType = 5 + DiscoveryEvent_DISCOVERY_PORT_DONE DiscoveryEvent_DiscoveryEventType = 6 + DiscoveryEvent_DISCOVERY_SERVICE_START DiscoveryEvent_DiscoveryEventType = 7 + DiscoveryEvent_DISCOVERY_SERVICE_FOUND DiscoveryEvent_DiscoveryEventType = 8 + DiscoveryEvent_DISCOVERY_SERVICE_DONE DiscoveryEvent_DiscoveryEventType = 9 + DiscoveryEvent_DISCOVERY_DONE DiscoveryEvent_DiscoveryEventType = 10 +) + +var DiscoveryEvent_DiscoveryEventType_name = map[int32]string{ + 0: "DISCOVERY_START", + 1: "DISCOVERY_HOST_START", + 2: "DISCOVERY_HOST_FOUND", + 3: "DISCOVERY_HOST_DONE", + 4: "DISCOVERY_PORT_START", + 5: "DISCOVERY_PORT_FOUND", + 6: "DISCOVERY_PORT_DONE", + 7: "DISCOVERY_SERVICE_START", + 8: "DISCOVERY_SERVICE_FOUND", + 9: "DISCOVERY_SERVICE_DONE", + 10: "DISCOVERY_DONE", +} +var DiscoveryEvent_DiscoveryEventType_value = map[string]int32{ + "DISCOVERY_START": 0, + "DISCOVERY_HOST_START": 1, + "DISCOVERY_HOST_FOUND": 2, + "DISCOVERY_HOST_DONE": 3, + "DISCOVERY_PORT_START": 4, + "DISCOVERY_PORT_FOUND": 5, + "DISCOVERY_PORT_DONE": 6, + "DISCOVERY_SERVICE_START": 7, + "DISCOVERY_SERVICE_FOUND": 8, + "DISCOVERY_SERVICE_DONE": 9, + "DISCOVERY_DONE": 10, +} + +func (x DiscoveryEvent_DiscoveryEventType) String() string { + return proto.EnumName(DiscoveryEvent_DiscoveryEventType_name, int32(x)) +} +func (DiscoveryEvent_DiscoveryEventType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{1, 0} +} + +type TaskResultEvent_TaskResultEventType int32 + +const ( + TaskResultEvent_TASK_POL_INTERVAL_UPDATE TaskResultEvent_TaskResultEventType = 0 + TaskResultEvent_TASK_SENSOR_START TaskResultEvent_TaskResultEventType = 1 + TaskResultEvent_TASK_SENSOR_STOP TaskResultEvent_TaskResultEventType = 2 + TaskResultEvent_TASK_SENSOR_ADD TaskResultEvent_TaskResultEventType = 3 + TaskResultEvent_TASK_SENSOR_REMOVE TaskResultEvent_TaskResultEventType = 4 + TaskResultEvent_TASK_SENSOR_UPDATE TaskResultEvent_TaskResultEventType = 5 + TaskResultEvent_TASK_CRAWLER_UPDATE TaskResultEvent_TaskResultEventType = 6 + TaskResultEvent_TASK_AGENT_UPDATE TaskResultEvent_TaskResultEventType = 7 + TaskResultEvent_TASK_LOG_SEND TaskResultEvent_TaskResultEventType = 8 +) + +var TaskResultEvent_TaskResultEventType_name = map[int32]string{ + 0: "TASK_POL_INTERVAL_UPDATE", + 1: "TASK_SENSOR_START", + 2: "TASK_SENSOR_STOP", + 3: "TASK_SENSOR_ADD", + 4: "TASK_SENSOR_REMOVE", + 5: "TASK_SENSOR_UPDATE", + 6: "TASK_CRAWLER_UPDATE", + 7: "TASK_AGENT_UPDATE", + 8: "TASK_LOG_SEND", +} +var TaskResultEvent_TaskResultEventType_value = map[string]int32{ + "TASK_POL_INTERVAL_UPDATE": 0, + "TASK_SENSOR_START": 1, + "TASK_SENSOR_STOP": 2, + "TASK_SENSOR_ADD": 3, + "TASK_SENSOR_REMOVE": 4, + "TASK_SENSOR_UPDATE": 5, + "TASK_CRAWLER_UPDATE": 6, + "TASK_AGENT_UPDATE": 7, + "TASK_LOG_SEND": 8, +} + +func (x TaskResultEvent_TaskResultEventType) String() string { + return proto.EnumName(TaskResultEvent_TaskResultEventType_name, int32(x)) +} +func (TaskResultEvent_TaskResultEventType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{2, 0} +} + +type AgentEvent_AgentEventType int32 + +const ( + AgentEvent_AGENT_STARTED AgentEvent_AgentEventType = 0 + AgentEvent_AGENT_ERROR AgentEvent_AgentEventType = 1 + AgentEvent_AGENT_STOP AgentEvent_AgentEventType = 2 +) + +var AgentEvent_AgentEventType_name = map[int32]string{ + 0: "AGENT_STARTED", + 1: "AGENT_ERROR", + 2: "AGENT_STOP", +} +var AgentEvent_AgentEventType_value = map[string]int32{ + "AGENT_STARTED": 0, + "AGENT_ERROR": 1, + "AGENT_STOP": 2, +} + +func (x AgentEvent_AgentEventType) String() string { + return proto.EnumName(AgentEvent_AgentEventType_name, int32(x)) +} +func (AgentEvent_AgentEventType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{3, 0} } + +type Empty struct { +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +// Event-relative area +type DiscoveryEvent struct { + AgentId string `protobuf:"bytes,1,opt,name=agentId" json:"agentId,omitempty"` + TaskId string `protobuf:"bytes,2,opt,name=taskId" json:"taskId,omitempty"` + EvtType DiscoveryEvent_DiscoveryEventType `protobuf:"varint,3,opt,name=evtType,enum=DiscoveryEvent_DiscoveryEventType" json:"evtType,omitempty"` + OccurredDate int64 `protobuf:"varint,4,opt,name=occurredDate" json:"occurredDate,omitempty"` + Data map[string]string `protobuf:"bytes,5,rep,name=data" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *DiscoveryEvent) Reset() { *m = DiscoveryEvent{} } +func (m *DiscoveryEvent) String() string { return proto.CompactTextString(m) } +func (*DiscoveryEvent) ProtoMessage() {} +func (*DiscoveryEvent) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *DiscoveryEvent) GetAgentId() string { + if m != nil { + return m.AgentId + } + return "" +} + +func (m *DiscoveryEvent) GetTaskId() string { + if m != nil { + return m.TaskId + } + return "" +} + +func (m *DiscoveryEvent) GetEvtType() DiscoveryEvent_DiscoveryEventType { + if m != nil { + return m.EvtType + } + return DiscoveryEvent_DISCOVERY_START +} + +func (m *DiscoveryEvent) GetOccurredDate() int64 { + if m != nil { + return m.OccurredDate + } + return 0 +} + +func (m *DiscoveryEvent) GetData() map[string]string { + if m != nil { + return m.Data + } + return nil +} + +type TaskResultEvent struct { + AgentId string `protobuf:"bytes,1,opt,name=agentId" json:"agentId,omitempty"` + TaskId string `protobuf:"bytes,2,opt,name=taskId" json:"taskId,omitempty"` + EvtType TaskResultEvent_TaskResultEventType `protobuf:"varint,3,opt,name=evtType,enum=TaskResultEvent_TaskResultEventType" json:"evtType,omitempty"` + OccurredDate int64 `protobuf:"varint,4,opt,name=occurredDate" json:"occurredDate,omitempty"` + Result TaskResultState `protobuf:"varint,5,opt,name=result,enum=TaskResultState" json:"result,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description" json:"description,omitempty"` +} + +func (m *TaskResultEvent) Reset() { *m = TaskResultEvent{} } +func (m *TaskResultEvent) String() string { return proto.CompactTextString(m) } +func (*TaskResultEvent) ProtoMessage() {} +func (*TaskResultEvent) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *TaskResultEvent) GetAgentId() string { + if m != nil { + return m.AgentId + } + return "" +} + +func (m *TaskResultEvent) GetTaskId() string { + if m != nil { + return m.TaskId + } + return "" +} + +func (m *TaskResultEvent) GetEvtType() TaskResultEvent_TaskResultEventType { + if m != nil { + return m.EvtType + } + return TaskResultEvent_TASK_POL_INTERVAL_UPDATE +} + +func (m *TaskResultEvent) GetOccurredDate() int64 { + if m != nil { + return m.OccurredDate + } + return 0 +} + +func (m *TaskResultEvent) GetResult() TaskResultState { + if m != nil { + return m.Result + } + return TaskResultState_FAILED +} + +func (m *TaskResultEvent) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +type AgentEvent struct { + AgentId string `protobuf:"bytes,1,opt,name=agentId" json:"agentId,omitempty"` + EvtType AgentEvent_AgentEventType `protobuf:"varint,2,opt,name=evtType,enum=AgentEvent_AgentEventType" json:"evtType,omitempty"` + OccurredDate int64 `protobuf:"varint,3,opt,name=occurredDate" json:"occurredDate,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description" json:"description,omitempty"` + ErrInfo *AgentEvent_ErrorInfo `protobuf:"bytes,5,opt,name=errInfo" json:"errInfo,omitempty"` +} + +func (m *AgentEvent) Reset() { *m = AgentEvent{} } +func (m *AgentEvent) String() string { return proto.CompactTextString(m) } +func (*AgentEvent) ProtoMessage() {} +func (*AgentEvent) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *AgentEvent) GetAgentId() string { + if m != nil { + return m.AgentId + } + return "" +} + +func (m *AgentEvent) GetEvtType() AgentEvent_AgentEventType { + if m != nil { + return m.EvtType + } + return AgentEvent_AGENT_STARTED +} + +func (m *AgentEvent) GetOccurredDate() int64 { + if m != nil { + return m.OccurredDate + } + return 0 +} + +func (m *AgentEvent) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *AgentEvent) GetErrInfo() *AgentEvent_ErrorInfo { + if m != nil { + return m.ErrInfo + } + return nil +} + +type AgentEvent_ErrorInfo struct { + ErrorNum int32 `protobuf:"varint,1,opt,name=errorNum" json:"errorNum,omitempty"` + From string `protobuf:"bytes,2,opt,name=from" json:"from,omitempty"` + ErrorMessage string `protobuf:"bytes,3,opt,name=errorMessage" json:"errorMessage,omitempty"` +} + +func (m *AgentEvent_ErrorInfo) Reset() { *m = AgentEvent_ErrorInfo{} } +func (m *AgentEvent_ErrorInfo) String() string { return proto.CompactTextString(m) } +func (*AgentEvent_ErrorInfo) ProtoMessage() {} +func (*AgentEvent_ErrorInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3, 0} } + +func (m *AgentEvent_ErrorInfo) GetErrorNum() int32 { + if m != nil { + return m.ErrorNum + } + return 0 +} + +func (m *AgentEvent_ErrorInfo) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *AgentEvent_ErrorInfo) GetErrorMessage() string { + if m != nil { + return m.ErrorMessage + } + return "" +} + +func init() { + proto.RegisterType((*Empty)(nil), "Empty") + proto.RegisterType((*DiscoveryEvent)(nil), "DiscoveryEvent") + proto.RegisterType((*TaskResultEvent)(nil), "TaskResultEvent") + proto.RegisterType((*AgentEvent)(nil), "AgentEvent") + proto.RegisterType((*AgentEvent_ErrorInfo)(nil), "AgentEvent.ErrorInfo") + proto.RegisterEnum("TaskResultState", TaskResultState_name, TaskResultState_value) + proto.RegisterEnum("DiscoveryEvent_DiscoveryEventType", DiscoveryEvent_DiscoveryEventType_name, DiscoveryEvent_DiscoveryEventType_value) + proto.RegisterEnum("TaskResultEvent_TaskResultEventType", TaskResultEvent_TaskResultEventType_name, TaskResultEvent_TaskResultEventType_value) + proto.RegisterEnum("AgentEvent_AgentEventType", AgentEvent_AgentEventType_name, AgentEvent_AgentEventType_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// 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 + +// Client API for Discovery service + +type DiscoveryClient interface { + Event(ctx context.Context, in *DiscoveryEvent, opts ...grpc.CallOption) (*Empty, error) +} + +type discoveryClient struct { + cc *grpc.ClientConn +} + +func NewDiscoveryClient(cc *grpc.ClientConn) DiscoveryClient { + return &discoveryClient{cc} +} + +func (c *discoveryClient) Event(ctx context.Context, in *DiscoveryEvent, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := grpc.Invoke(ctx, "/Discovery/event", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Discovery service + +type DiscoveryServer interface { + Event(context.Context, *DiscoveryEvent) (*Empty, error) +} + +func RegisterDiscoveryServer(s *grpc.Server, srv DiscoveryServer) { + s.RegisterService(&_Discovery_serviceDesc, srv) +} + +func _Discovery_Event_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DiscoveryEvent) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiscoveryServer).Event(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Discovery/Event", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiscoveryServer).Event(ctx, req.(*DiscoveryEvent)) + } + return interceptor(ctx, in, info, handler) +} + +var _Discovery_serviceDesc = grpc.ServiceDesc{ + ServiceName: "Discovery", + HandlerType: (*DiscoveryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "event", + Handler: _Discovery_Event_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "event.proto", +} + +// Client API for TaskResult service + +type TaskResultClient interface { + Event(ctx context.Context, in *TaskResultEvent, opts ...grpc.CallOption) (*Empty, error) +} + +type taskResultClient struct { + cc *grpc.ClientConn +} + +func NewTaskResultClient(cc *grpc.ClientConn) TaskResultClient { + return &taskResultClient{cc} +} + +func (c *taskResultClient) Event(ctx context.Context, in *TaskResultEvent, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := grpc.Invoke(ctx, "/TaskResult/event", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for TaskResult service + +type TaskResultServer interface { + Event(context.Context, *TaskResultEvent) (*Empty, error) +} + +func RegisterTaskResultServer(s *grpc.Server, srv TaskResultServer) { + s.RegisterService(&_TaskResult_serviceDesc, srv) +} + +func _TaskResult_Event_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TaskResultEvent) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TaskResultServer).Event(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/TaskResult/Event", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TaskResultServer).Event(ctx, req.(*TaskResultEvent)) + } + return interceptor(ctx, in, info, handler) +} + +var _TaskResult_serviceDesc = grpc.ServiceDesc{ + ServiceName: "TaskResult", + HandlerType: (*TaskResultServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "event", + Handler: _TaskResult_Event_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "event.proto", +} + +// Client API for Event service + +type EventClient interface { + Event(ctx context.Context, in *AgentEvent, opts ...grpc.CallOption) (*Empty, error) +} + +type eventClient struct { + cc *grpc.ClientConn +} + +func NewEventClient(cc *grpc.ClientConn) EventClient { + return &eventClient{cc} +} + +func (c *eventClient) Event(ctx context.Context, in *AgentEvent, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := grpc.Invoke(ctx, "/Event/event", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Event service + +type EventServer interface { + Event(context.Context, *AgentEvent) (*Empty, error) +} + +func RegisterEventServer(s *grpc.Server, srv EventServer) { + s.RegisterService(&_Event_serviceDesc, srv) +} + +func _Event_Event_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AgentEvent) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EventServer).Event(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Event/Event", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EventServer).Event(ctx, req.(*AgentEvent)) + } + return interceptor(ctx, in, info, handler) +} + +var _Event_serviceDesc = grpc.ServiceDesc{ + ServiceName: "Event", + HandlerType: (*EventServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "event", + Handler: _Event_Event_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "event.proto", +} + +func init() { proto.RegisterFile("event.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 719 bytes of a gzipped FileDescript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, 0x69, 0x9a, 0x55, 0x1f, 0x42, 0x79, 0x85, 0x62, 0x1d, 0xf6, 0x58, 0x14, + 0xf4, 0xe6, 0x0f, 0xfc, 0x50, 0x32, 0x5d, 0xc5, 0x88, 0x50, 0xbc, 0x0e, 0xfc, 0x87, 0xc4, 0xaf, + 0x7c, 0x1d, 0xf5, 0xcc, 0xf9, 0x4b, 0x36, 0x9b, 0x79, 0x37, 0x71, 0xcf, 0x65, 0xba, 0x81, 0xe9, + 0x26, 0x54, 0x37, 0x8f, 0x1c, 0xdd, 0x6d, 0x7c, 0xdb, 0x7c, 0xee, 0xc4, 0x54, 0x0b, 0x58, 0x83, + 0x4a, 0x0c, 0x11, 0x4a, 0x6d, 0xaa, 0x0a, 0x58, 0x05, 0x48, 0x73, 0x22, 0x13, 0x3c, 0x3d, 0xcb, + 0x7e, 0x5c, 0xdc, 0xa4, 0x08, 0xa0, 0x9c, 0x1b, 0x56, 0x97, 0xd7, 0x57, 0xa0, 0xe4, 0x5c, 0x75, + 0x3a, 0x84, 0x98, 0x71, 0x6d, 0x9f, 0xda, 0x51, 0x60, 0xf5, 0x2e, 0x54, 0xb1, 0x7d, 0x0a, 0xe5, + 0xd5, 0x43, 0x86, 0x3a, 0xc8, 0xfc, 0xf5, 0xc7, 0x5a, 0xee, 0xe5, 0xac, 0x2b, 0xad, 0xf8, 0x3f, + 0x50, 0x68, 0x3f, 0x07, 0x58, 0x6f, 0x86, 0x8f, 0xd2, 0x0a, 0x35, 0xff, 0xe9, 0x65, 0x4a, 0x9e, + 0x80, 0x1c, 0xdb, 0xe2, 0xff, 0x34, 0xbb, 0x92, 0xb9, 0xf8, 0x75, 0xe2, 0x27, 0x85, 0xff, 0x75, + 0x5e, 0xfc, 0x08, 0x00, 0x00, 0xff, 0xff, 0xe6, 0xb0, 0x7e, 0x78, 0x84, 0x06, 0x00, 0x00, +} diff --git a/initialize/initialize.pb.go b/initialize/initialize.pb.go new file mode 100644 index 0000000..e474c2b --- /dev/null +++ b/initialize/initialize.pb.go @@ -0,0 +1,169 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: initialize.proto + +/* +Package initialize is a generated protocol buffer package. + +It is generated from these files: + initialize.proto + +It has these top-level messages: + Empty + AgentInfo + InitResponse +*/ +package initialize + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Empty struct { +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type AgentInfo struct { + AgentId string `protobuf:"bytes,1,opt,name=agentId" json:"agentId,omitempty"` +} + +func (m *AgentInfo) Reset() { *m = AgentInfo{} } +func (m *AgentInfo) String() string { return proto.CompactTextString(m) } +func (*AgentInfo) ProtoMessage() {} +func (*AgentInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *AgentInfo) GetAgentId() string { + if m != nil { + return m.AgentId + } + return "" +} + +type InitResponse struct { + SecretKey string `protobuf:"bytes,1,opt,name=secretKey" json:"secretKey,omitempty"` +} + +func (m *InitResponse) Reset() { *m = InitResponse{} } +func (m *InitResponse) String() string { return proto.CompactTextString(m) } +func (*InitResponse) ProtoMessage() {} +func (*InitResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *InitResponse) GetSecretKey() string { + if m != nil { + return m.SecretKey + } + return "" +} + +func init() { + proto.RegisterType((*Empty)(nil), "Empty") + proto.RegisterType((*AgentInfo)(nil), "AgentInfo") + proto.RegisterType((*InitResponse)(nil), "InitResponse") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// 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 + +// Client API for Initializer service + +type InitializerClient interface { + AgentStarting(ctx context.Context, in *AgentInfo, opts ...grpc.CallOption) (*InitResponse, error) +} + +type initializerClient struct { + cc *grpc.ClientConn +} + +func NewInitializerClient(cc *grpc.ClientConn) InitializerClient { + return &initializerClient{cc} +} + +func (c *initializerClient) AgentStarting(ctx context.Context, in *AgentInfo, opts ...grpc.CallOption) (*InitResponse, error) { + out := new(InitResponse) + err := grpc.Invoke(ctx, "/Initializer/agentStarting", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Initializer service + +type InitializerServer interface { + AgentStarting(context.Context, *AgentInfo) (*InitResponse, error) +} + +func RegisterInitializerServer(s *grpc.Server, srv InitializerServer) { + s.RegisterService(&_Initializer_serviceDesc, srv) +} + +func _Initializer_AgentStarting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AgentInfo) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InitializerServer).AgentStarting(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Initializer/AgentStarting", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InitializerServer).AgentStarting(ctx, req.(*AgentInfo)) + } + return interceptor(ctx, in, info, handler) +} + +var _Initializer_serviceDesc = grpc.ServiceDesc{ + ServiceName: "Initializer", + HandlerType: (*InitializerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "agentStarting", + Handler: _Initializer_AgentStarting_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "initialize.proto", +} + +func init() { proto.RegisterFile("initialize.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 153 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0xcc, 0xcb, 0x2c, + 0xc9, 0x4c, 0xcc, 0xc9, 0xac, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0x62, 0xe7, 0x62, + 0x75, 0xcd, 0x2d, 0x28, 0xa9, 0x54, 0x52, 0xe5, 0xe2, 0x74, 0x4c, 0x4f, 0xcd, 0x2b, 0xf1, 0xcc, + 0x4b, 0xcb, 0x17, 0x92, 0xe0, 0x62, 0x4f, 0x04, 0x73, 0x52, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38, + 0x83, 0x60, 0x5c, 0x25, 0x1d, 0x2e, 0x1e, 0xcf, 0xbc, 0xcc, 0x92, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, + 0xbc, 0xe2, 0x54, 0x21, 0x19, 0x2e, 0xce, 0xe2, 0xd4, 0xe4, 0xa2, 0xd4, 0x12, 0xef, 0xd4, 0x4a, + 0xa8, 0x5a, 0x84, 0x80, 0x91, 0x35, 0x17, 0xb7, 0x27, 0xdc, 0xc6, 0x22, 0x21, 0x1d, 0x2e, 0x5e, + 0xb0, 0x39, 0xc1, 0x25, 0x89, 0x45, 0x25, 0x99, 0x79, 0xe9, 0x42, 0x5c, 0x7a, 0x70, 0x3b, 0xa5, + 0x78, 0xf5, 0x90, 0x0d, 0x56, 0x62, 0x48, 0x62, 0x03, 0xbb, 0xd0, 0x18, 0x10, 0x00, 0x00, 0xff, + 0xff, 0x10, 0x56, 0xdb, 0xad, 0xb5, 0x00, 0x00, 0x00, +} diff --git a/task/task.pb.go b/task/task.pb.go new file mode 100644 index 0000000..17e24c9 --- /dev/null +++ b/task/task.pb.go @@ -0,0 +1,189 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: task.proto + +/* +Package task is a generated protocol buffer package. + +It is generated from these files: + task.proto + +It has these top-level messages: + Empty + TaskInfo + TaskList +*/ +package task + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Empty struct { +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type TaskInfo struct { + Command string `protobuf:"bytes,1,opt,name=command" json:"command,omitempty"` + TaskId string `protobuf:"bytes,2,opt,name=taskId" json:"taskId,omitempty"` + Data map[string]string `protobuf:"bytes,3,rep,name=data" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *TaskInfo) Reset() { *m = TaskInfo{} } +func (m *TaskInfo) String() string { return proto.CompactTextString(m) } +func (*TaskInfo) ProtoMessage() {} +func (*TaskInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *TaskInfo) GetCommand() string { + if m != nil { + return m.Command + } + return "" +} + +func (m *TaskInfo) GetTaskId() string { + if m != nil { + return m.TaskId + } + return "" +} + +func (m *TaskInfo) GetData() map[string]string { + if m != nil { + return m.Data + } + return nil +} + +type TaskList struct { + TaskList []*TaskInfo `protobuf:"bytes,1,rep,name=taskList" json:"taskList,omitempty"` +} + +func (m *TaskList) Reset() { *m = TaskList{} } +func (m *TaskList) String() string { return proto.CompactTextString(m) } +func (*TaskList) ProtoMessage() {} +func (*TaskList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *TaskList) GetTaskList() []*TaskInfo { + if m != nil { + return m.TaskList + } + return nil +} + +func init() { + proto.RegisterType((*Empty)(nil), "Empty") + proto.RegisterType((*TaskInfo)(nil), "TaskInfo") + proto.RegisterType((*TaskList)(nil), "TaskList") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// 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 + +// Client API for Task service + +type TaskClient interface { + RequestTask(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TaskList, error) +} + +type taskClient struct { + cc *grpc.ClientConn +} + +func NewTaskClient(cc *grpc.ClientConn) TaskClient { + return &taskClient{cc} +} + +func (c *taskClient) RequestTask(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TaskList, error) { + out := new(TaskList) + err := grpc.Invoke(ctx, "/Task/requestTask", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Task service + +type TaskServer interface { + RequestTask(context.Context, *Empty) (*TaskList, error) +} + +func RegisterTaskServer(s *grpc.Server, srv TaskServer) { + s.RegisterService(&_Task_serviceDesc, srv) +} + +func _Task_RequestTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TaskServer).RequestTask(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Task/RequestTask", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TaskServer).RequestTask(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +var _Task_serviceDesc = grpc.ServiceDesc{ + ServiceName: "Task", + HandlerType: (*TaskServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "requestTask", + Handler: _Task_RequestTask_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "task.proto", +} + +func init() { proto.RegisterFile("task.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 218 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2c, 0xce, + 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0x62, 0xe7, 0x62, 0x75, 0xcd, 0x2d, 0x28, 0xa9, 0x54, + 0x9a, 0xc7, 0xc8, 0xc5, 0x11, 0x92, 0x58, 0x9c, 0xed, 0x99, 0x97, 0x96, 0x2f, 0x24, 0xc1, 0xc5, + 0x9e, 0x9c, 0x9f, 0x9b, 0x9b, 0x98, 0x97, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe3, + 0x0a, 0x89, 0x71, 0xb1, 0x81, 0x74, 0x7b, 0xa6, 0x48, 0x30, 0x81, 0x25, 0xa0, 0x3c, 0x21, 0x75, + 0x2e, 0x96, 0x94, 0xc4, 0x92, 0x44, 0x09, 0x66, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x61, 0x3d, 0x98, + 0x51, 0x7a, 0x2e, 0x89, 0x25, 0x89, 0xae, 0x79, 0x25, 0x45, 0x95, 0x41, 0x60, 0x05, 0x52, 0xe6, + 0x5c, 0x9c, 0x70, 0x21, 0x21, 0x01, 0x2e, 0xe6, 0xec, 0xd4, 0x4a, 0xa8, 0x1d, 0x20, 0xa6, 0x90, + 0x08, 0x17, 0x6b, 0x59, 0x62, 0x4e, 0x69, 0x2a, 0xd4, 0x78, 0x08, 0xc7, 0x8a, 0xc9, 0x82, 0x51, + 0xc9, 0x10, 0xe2, 0x3e, 0x9f, 0xcc, 0xe2, 0x12, 0x21, 0x55, 0x2e, 0x8e, 0x12, 0x28, 0x5b, 0x82, + 0x11, 0x6c, 0x23, 0x27, 0xdc, 0xc6, 0x20, 0xb8, 0x94, 0x91, 0x16, 0x17, 0x0b, 0x48, 0x54, 0x48, + 0x89, 0x8b, 0xbb, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x04, 0xcc, 0x65, 0xd3, 0x03, 0x7b, 0x59, + 0x0a, 0xa2, 0x07, 0xa4, 0x52, 0x89, 0x21, 0x89, 0x0d, 0x1c, 0x1e, 0xc6, 0x80, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xc7, 0x05, 0x41, 0xed, 0x1d, 0x01, 0x00, 0x00, +}