From 54608d4fd5fb467641a061d17681e68d60a57150 Mon Sep 17 00:00:00 2001 From: "insanity@loafle.com" Date: Sat, 20 May 2017 18:27:30 +0900 Subject: [PATCH] proto --- commons/commons.proto | 28 ++++++++++++++++++++++++++++ event/event.proto | 38 ++------------------------------------ task/task.proto | 2 +- 3 files changed, 31 insertions(+), 37 deletions(-) create mode 100644 commons/commons.proto diff --git a/commons/commons.proto b/commons/commons.proto new file mode 100644 index 0000000..57e9590 --- /dev/null +++ b/commons/commons.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +enum DiscoveryEventType { + 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; +} + +enum TaskEventType { + 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; + TASK_DISCOVERY = 9; +} diff --git a/event/event.proto b/event/event.proto index ae9127f..d4f3488 100644 --- a/event/event.proto +++ b/event/event.proto @@ -2,33 +2,10 @@ syntax = "proto3"; message Empty {} -//Event-relative area -message DiscoveryEvent { - string agentId = 1; - string taskId = 2; - enum DiscoveryEventType { - 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; - } - DiscoveryEventType evtType = 3; - int64 occurredDate = 4; - map data = 5; -} - service Discovery { rpc event(DiscoveryEvent) returns (Empty){} } - enum TaskResultState { FAILED = 0; SUCCEED = 1; @@ -38,21 +15,10 @@ enum TaskResultState { message TaskResultEvent { string agentId = 1; string taskId = 2; - enum TaskResultEventType { - 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; - } - TaskResultEventType evtType = 3; + TaskEventType evtType = 3; int64 occurredDate = 4; TaskResultState result = 5; - string description = 6; + map data = 6; } service TaskResult { diff --git a/task/task.proto b/task/task.proto index 2e6a86a..b5dba5b 100644 --- a/task/task.proto +++ b/task/task.proto @@ -3,7 +3,7 @@ syntax = "proto3"; message Empty {} message TaskInfo { - string command = 1; + TaskEvent command = 1; string taskId = 2; map data = 3; }