syntax = "proto3";

package enginepb;

import "engine/proto/projects.proto";

option go_package = "github.com/pingcap/tiflow/engine/enginepb";

service ExecutorService {
    rpc PreDispatchTask(PreDispatchTaskRequest) returns (PreDispatchTaskResponse) {}
    rpc ConfirmDispatchTask(ConfirmDispatchTaskRequest) returns (ConfirmDispatchTaskResponse) {}
}

message PreDispatchTaskRequest {
    int64 task_type_id = 1;
    bytes task_config = 2;
    string master_id = 3;
    string worker_id = 4;
    ProjectInfo project_info = 5;
    
    // request_id should be a UUID unique for each RPC call.
    string request_id = 6;
    int64 worker_epoch = 7;
}

message PreDispatchTaskResponse {
}

message ConfirmDispatchTaskRequest {
    // Note: worker_id and request_id must match the
    // corresponding fields in PreDispatchTaskRequest.

    string worker_id = 1;
    string request_id = 2;
}

message ConfirmDispatchTaskResponse {
}

service BrokerService {
    rpc RemoveResource(RemoveLocalResourceRequest) returns (RemoveLocalResourceResponse){}
}

message RemoveLocalResourceRequest {
    string resource_id = 1;
    // creator of the resource
    string worker_id = 2;
}

message RemoveLocalResourceResponse {}
