commit f44fec8c60a22b8524fd2674023cefd4dd913318 Author: insanity@loafle.com Date: Fri May 19 20:11:41 2017 +0900 grpc .proto has added. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..056ffb8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,63 @@ +# Created by .ignore support plugin (hsz.mobi) +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +### Go template +# Binaries for programs and plugins +*.exe +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 +.glide/ + +.gitignore +.idea/ diff --git a/grpc/grpc.proto b/grpc/grpc.proto new file mode 100644 index 0000000..e35b89d --- /dev/null +++ b/grpc/grpc.proto @@ -0,0 +1,135 @@ +syntax = "proto3"; + + +message Empty {} + +//Event-relative area +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; +} + +message DiscoveryEvent { + string agentId = 1; + string taskId = 2; + DiscoveryEventType evtType = 3; + int64 occurredDate = 4; + map data = 5; +} + +service Discovery { + rpc event(DiscoveryEvent) returns (Empty){} +} + +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; +} + +enum TaskResultState { + FAILED = 0; + SUCCEED = 1; + PROCEEDING = 2; +} + +message TaskResultEvent { + string agentId = 1; + string taskId = 2; + TaskResultEventType evtType = 3; + int64 occurredDate = 4; + TaskResultState result = 5; + string description = 6; +} + +service TaskResult { + rpc event(TaskResultEvent) returns (Empty){} +} + +enum AgentEventType { + AGENT_STARTED = 0; + AGENT_ERROR = 1; + AGENT_STOP = 2; +} + +message ErrorInfo { + int32 errorNum = 1; + string from = 2; + string errorMessage = 3; +} + +message AgentEvent { + string agentId = 1; + AgentEventType evtType = 2; + int64 occurredDate = 3; + string description = 4; + ErrorInfo errInfo = 5; +} + +service Event { + rpc event(AgentEvent) returns (Empty){} +} +//Event-relative area + + +//Data-relative area +message CollectedData { + string agentId = 1; + string sensorId = 2; + map data = 3; + int64 startDate = 4; + int64 finishDate = 5; +} + +service Data { + rpc sendMetric(CollectedData) returns (Empty) {} + rpc sendMeta(CollectedData) returns (Empty) {} +} +//Data-relative area + + +//Task polling-relative area +message TaskInfo { + string command = 1; + string taskId = 2; + map data = 3; +} + +message TaskList { + repeated TaskInfo taskList = 1; +} + +service Task { + rpc requestTask(Empty) returns (TaskList) {} +} +//Task polling-relative area + + +//Init-relative area +message AgentInfo { + string agentId = 1; +} + +message InitResponse { + string secretKey = 1; +} + +service Initializer { + rpc agentStarting(AgentInfo) returns (InitResponse) {} +} +//Init-relative area \ No newline at end of file