syntax = "proto3"; package scalebox; option go_package="./;scalebox"; option java_multiple_files = true; // option java_outer_classname = "ControlProto"; option java_package = "cn.scalebox.gprc"; import "google/protobuf/timestamp.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/wrappers.proto"; service ControlService { // ////////////////////////////////////////////////////////////////// // actuator client // ////////////////////////////////////////////////////////////////// // parameter : inline_cluster_name rpc GetInlineSlotList(google.protobuf.StringValue) returns (InlineSlotList); // parameter : external_cluster_name rpc GetExternalSlotList(google.protobuf.StringValue) returns (ExternalSlotList); // 'slot_run' only for the inline cluster,called by actuator // 'agent_setup'/'agent_teardown', called by agent // rpc SetSlotRunning(SlotExecMessage) returns (google.protobuf.Empty); rpc SaveClientExecInfo(ClientExecMessage) returns (google.protobuf.Empty); // ////////////////////////////////////////////////////////////////// // agent client // ////////////////////////////////////////////////////////////////// // parameter : slot_id // slot: 'READY' -> 'ON' rpc SetSlotInitialized(google.protobuf.Int32Value) returns (google.protobuf.Empty); // slot exit automatically, slot : 'ON' -> 'OFF'/'READY' // parameter : slot_id rpc SetSlotTerminated(google.protobuf.Int32Value) returns (google.protobuf.Empty);; // parameter : job_id/host_ip, sep=',' // return : slot id rpc RegisterSlot(google.protobuf.StringValue) returns (google.protobuf.Int32Value); // parameter : slot_id rpc DeregisterSlot(google.protobuf.Int32Value) returns (google.protobuf.Empty); // task id : 'READY/-1' -> 'QUEUED/-2' // parameter : slot_id('ON') // return : job-key of the task, id==0(NULL) rpc GetNextTask(google.protobuf.Int32Value) returns (TaskItem); // task_status_code:'QUEUED'/-2 -> 'RUNNING'/-3 // parameter : task_id('QUEUED/-2') rpc SetTaskStarted(google.protobuf.Int64Value) returns (google.protobuf.Empty); // task_status_code:'RUNNING'/-3 -> 'OK'/0, ... // parameter : TaskExecMessage rpc SetTaskFinished(TaskExecMessage) returns (google.protobuf.Empty); // input : slot id // return : ret_code < 0 exit rpc CheckSlotHeartbeat(google.protobuf.Int32Value) returns (google.protobuf.Int32Value); // send job-key to next job in current pipeline // return : task_id(OK), <0 (error) // task_status_code : 'INITIAL'/-9 rpc SendMessage(JobKey) returns (google.protobuf.Int64Value); // send 'START' message to head job, and set its status to running // rpc SetAppRunning(google.protobuf.Int32Value) returns (google.protobuf.Int32Value); } message JobKey { message JobIdRef{ // qualified name of job string sink_job_name=1; // for sink-job in the same app int32 current_job_id=2; } message JobIdAppRef{ // qualified name of job string sink_job_name=1; // for sink-job in remote server (app id) int32 app_id=2; // for controld/grpc-server string remote_server=3; } oneof jobId { // for the same app JobIdRef builtin_job_id=1; // for different app in the same cluster int32 cross_app_job_id=2; // for cross-cluster app JobIdAppRef cross_server_job_id=3; } // 1. multi-messages : comma-sep // 2. customized sep : json-format // label: "multi-messages", text: "abc:134:345ß" string key_text=10; bool async_task_creation=20; map headers = 21; } message TaskItem { int64 id=1; string key=2; } message InlineSlotInfo { // primary key of slot table int32 id=1; string host=2; int32 port=3; string uname=4; string command_text=5; } message InlineSlotList { repeated InlineSlotInfo slots=1; } message ExternalSlotList { repeated ExternalSlotInfo slots=1; } message ExternalSlotInfo { int32 job_id=1; string command_text=2; int32 num_slots=3; map resource_req=4; } message TaskExecMessage { int32 slot=1; int32 status_code=2; int64 task_id=3; int64 input_bytes=4; int64 output_bytes=5; google.protobuf.Timestamp t0=6; google.protobuf.Timestamp t1=7; google.protobuf.Timestamp t2=8; google.protobuf.Timestamp t3=9; google.protobuf.Timestamp t4=10; repeated google.protobuf.Timestamp tc_arr=11; string stdout=12; string stderr=13; string userText=14; } message ClientExecMessage { // message SlotExecMessage { int32 slot=1; // return code int32 code=2; string stdout=3; string stderr=4; // client start time google.protobuf.Timestamp tc0=5; // client end time google.protobuf.Timestamp tc1=6; // 'slot_run', 'agent_setup', 'agent_teardown' string action=7; }