syntax = "proto3";

package enginepb;

import "engine/proto/projects.proto";

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

service ResourceManager {
  rpc CreateResource(CreateResourceRequest) returns (CreateResourceResponse){}
  rpc QueryResource(QueryResourceRequest) returns (QueryResourceResponse){}

  // RemoveResource only cleans up the metadata of the resource.
  // The invoker should handle the actual resource cleaning up on its own.
  rpc RemoveResource(RemoveResourceRequest) returns (RemoveResourceResponse){}
}

message CreateResourceRequest {
  ProjectInfo project_info = 1;
  string resource_id = 2;
  string creator_executor = 3;
  string job_id = 4;
  string creator_worker_id = 5;
}

message CreateResourceResponse {}

message ResourceKey {
    string job_id = 1;
    string resource_id = 2;
}

message QueryResourceRequest {
    ResourceKey resource_key = 1;
}

message QueryResourceResponse {
  string creator_executor = 1;
  string job_id = 2;
  string creator_worker_id = 3;
}

message RemoveResourceRequest {
    ResourceKey resource_key = 1;
}

message RemoveResourceResponse {}
