syntax = "proto3";

package sail.worker;

message TaskStreamTicket {
  string channel = 1;
}

message RunTaskRequest {
  uint64 task_id = 1;
  uint64 attempt = 2;
  bytes plan = 3;
  uint64 partition = 4;
  optional string channel = 5;
}

message RunTaskResponse {
}

message StopTaskRequest {
  uint64 task_id = 1;
  uint64 attempt = 2;
}

message StopTaskResponse {
}

message RemoveStreamRequest {
  string channel_prefix = 1;
}

message RemoveStreamResponse {
}

message StopWorkerRequest {
}

message StopWorkerResponse {
}

service WorkerService {
  rpc RunTask(RunTaskRequest) returns (RunTaskResponse) {}
  rpc StopTask(StopTaskRequest) returns (StopTaskResponse) {}
  rpc RemoveStream(RemoveStreamRequest) returns (RemoveStreamResponse) {}
  rpc StopWorker(StopWorkerRequest) returns (StopWorkerResponse) {}
}
