syntax = "proto3"; package scalebox; option go_package="./;scalebox"; option java_multiple_files = true; // option java_outer_classname = "BoxProto"; option java_package = "cn.scalebox.gprc"; import "google/protobuf/timestamp.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/wrappers.proto"; service BoxService { // ////////////////////////////////////////////////////////////////// // agent client // ////////////////////////////////////////////////////////////////// // input : slot id('ON') // return : job-key of the task, id==0(NULL) // task id : 'READY/-1' -> 'QUEUED/-2' rpc GetNextTask(google.protobuf.Int32Value) returns (TaskItem); // input : task id('QUEUED/-2') // return : ret_code : 0(OK), -1(task NOT FOUND), -2(WRONG STATUS) // task_status_code:'QUEUED'/-2 -> 'RUNNING'/-3 rpc SetTaskStarted(google.protobuf.Int64Value) returns (google.protobuf.Int32Value); // input : TaskExecMessage // return : ret_code : 0(OK), -1(task NOT FOUND), -2(task WRONG STATUS) // task_status_code:'RUNNING'/-3 -> 'OK'/0, ... rpc SetTaskFinished(TaskExecMessage) returns (google.protobuf.Int32Value); // slot exit automatically, called in agent side // input : slot id // return : ret_code : 0(OK), -1(slot NOT FOUND), -2(slot WRONG STATUS) // slot : 'ON' -> 'OFF' rpc SetSlotTerminated(google.protobuf.Int32Value) returns (google.protobuf.Int32Value); // ////////////////////////////////////////////////////////////////// // actuator client // ////////////////////////////////////////////////////////////////// // input: token_string ? // job:'RUNNING' && slot:'READY' rpc GetRunnableSlotList(google.protobuf.Empty) returns (CommandList); // input : slot id // return : ret_code : 0(OK), -1(slot NOT FOUND), -2(slot WRONG STATUS) // slot: 'READY' -> 'ON' rpc SetSlotInitialized(google.protobuf.Int32Value) returns (google.protobuf.Int32Value); // job:'RUNNING' && worker:'PAUSED' rpc GetRunnableWorkerList(google.protobuf.Empty) returns (CommandList); // input : worker id // return : ret_code : 0(OK), -1(worker NOT FOUND), -2(worker WRONG STATUS) // worker: 'PAUSED' -> 'RUNNING' rpc SetWorkerInitialized(google.protobuf.Int32Value) returns (google.protobuf.Int32Value); // job:'PAUSED' && worker:'RUNNING' rpc GetTerminableWorkerList(google.protobuf.Empty) returns (CommandList); // input : worker id, return ret_code; // return : ret_code : 0(OK), -1(worker NOT FOUND), -2(worker WRONG STATUS) // worker : 'RUNNING' -> 'PAUSED' rpc SetWorkerTerminated(google.protobuf.Int32Value) returns (google.protobuf.Int32Value); // ////////////////////////////////////////////////////////////////// // app client , called by user app. // ////////////////////////////////////////////////////////////////// // send task-key to next job in current pipeline // return : ret_code : 0(OK), -1(job NOT FOUND) // task_status_code : 'INITIAL'/-9 rpc SendToNextJob(JobKey) returns (google.protobuf.Int32Value); rpc SendMessagesToNext(JobKeys) returns (google.protobuf.Int32Value); } message JobKey { // qualified name of job string job_name=1; string key_text=2; int32 slot_id=3; // OR worker_id ? job_id ? } message JobKeys { // qualified name of job string next_job_name=1; repeated string key_texts=2; int32 current_job_id=3; // OR worker_id ? } message TaskItem { int64 id=1; string key=2; } message Command { // primary key of slot/worker table int32 id=1; string host=2; string command_text=3; } message CommandList { repeated Command command=1; } 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 time_arr=11; string sys_out=12; string app_out=13; }