Skip to content
Merged
101 changes: 101 additions & 0 deletions protos/durable-task-scheduler/sandbox_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

syntax = "proto3";

package microsoft.durabletask.sandboxes;

option csharp_namespace = "Microsoft.DurableTask.Protobuf.Sandboxes";

service SandboxActivities {
// Opens a live sandbox activity worker session. The first message
// must be a start message with static worker metadata. Heartbeats carry
// dynamic state only. Closing the stream deregisters the worker.
rpc ConnectSandboxActivityWorker(stream SandboxActivityWorkerMessage) returns (SandboxActivityWorkerSessionResult);

// Creates or updates a sandbox worker profile before any live worker stream exists.
// This is a configuration contract and does not advertise active worker
// capacity.
rpc DeclareSandboxWorkerProfile(SandboxWorkerProfile) returns (DeclareSandboxWorkerProfileResult);

// Removes a sandbox worker profile so the backend stops
// waking new sandbox workers for the specified worker profile. Existing
// workers are not terminated by this RPC.
rpc RemoveSandboxWorkerProfile(RemoveSandboxWorkerProfileRequest) returns (RemoveSandboxWorkerProfileResult);
}

message SandboxActivityWorkerMessage {
oneof message {
SandboxActivityWorkerStart start = 1;
SandboxActivityWorkerHeartbeat heartbeat = 2;
}
}

message SandboxActivityWorkerStart {
string task_hub = 1;
int32 max_activities_count = 2;
// Sandbox provider the worker is running in. UNSPECIFIED = legacy
// (pre-provider-aware) workers.
SandboxProviderKind sandbox_provider = 3;
// DTS-generated sandbox identifier injected as DTS_SANDBOX_ID. This is not
// the ADC provider sandbox resource id.
string dts_sandbox_identifier = 4;
// Caller-defined profile/catalog ID shared by worker profiles and live worker registration.
string worker_profile_id = 5;
// Activity handlers registered by the worker process. DTS validates this
// matches the worker profile before advertising worker capacity.
repeated SandboxActivity activities = 6;
}

message SandboxActivityWorkerHeartbeat {
int32 active_activities_count = 1;
}

message SandboxActivityWorkerSessionResult {
string message = 1;
}

message SandboxWorkerProfile {
// Caller-defined profile/catalog ID shared by worker profiles and live worker registration.
string worker_profile_id = 1;
repeated SandboxActivity activities = 2;
SandboxActivityImage image = 3;
map<string, string> environment_variables = 4;
int32 max_concurrent_activities = 5;
SandboxActivityResources resources = 6;
string scheduler_managed_identity_client_id = 7;
}

message SandboxActivity {
string name = 1;
string version = 2;
}

message SandboxActivityImage {
string image_ref = 1;
string managed_identity_client_id = 2;
repeated string entrypoint = 3;
repeated string cmd = 4;
}

message SandboxActivityResources {
string cpu = 1;
string memory = 2;
}

message DeclareSandboxWorkerProfileResult {
}

message RemoveSandboxWorkerProfileRequest {
string worker_profile_id = 1;
}

message RemoveSandboxWorkerProfileResult {
}

// Sandbox provider executing the activity worker.
enum SandboxProviderKind {
SANDBOX_PROVIDER_KIND_UNSPECIFIED = 0;
SANDBOX_PROVIDER_KIND_ACA_SESSION_POOL = 1;
SANDBOX_PROVIDER_KIND_SANDBOX = 2;
}