syntax = "proto3";
package maelstrom_client_base.items;
message ClusterCommunicationStrategy {
oneof strategy {
TcpClusterCommunicationStrategy tcp = 1;
GitHubClusterCommunicationStrategy git_hub = 2;
}
}
message TcpClusterCommunicationStrategy {
string broker = 1;
}
message GitHubClusterCommunicationStrategy {
string token = 1;
string url = 2;
}
message StartRequest {
bytes project_dir = 2;
bytes cache_dir = 4;
uint64 cache_size = 5;
uint64 inline_limit = 6;
uint32 slots = 7;
bytes container_image_depot_dir = 8;
bool accept_invalid_remote_container_tls_certs = 9;
optional ClusterCommunicationStrategy cluster_communication_strategy = 11;
}
message TarLayer {
string path = 1;
}
message PrefixOptions {
optional string strip_prefix = 1;
optional string prepend_prefix = 2;
bool canonicalize = 3;
bool follow_symlinks = 4;
}
message GlobLayer {
string glob = 1;
PrefixOptions prefix_options = 2;
}
message PathsLayer {
repeated string paths = 1;
PrefixOptions prefix_options = 2;
}
message StubsLayer {
repeated string stubs = 1;
}
message SymlinkSpec {
string link = 1;
string target = 2;
}
message SymlinksLayer {
repeated SymlinkSpec symlinks = 1;
}
message SharedLibraryDependenciesLayer {
repeated string binary_paths = 1;
PrefixOptions prefix_options = 2;
}
message LayerSpec {
oneof spec {
TarLayer tar = 1;
GlobLayer glob = 2;
PathsLayer paths = 3;
StubsLayer stubs = 4;
SymlinksLayer symlinks = 5;
SharedLibraryDependenciesLayer shared_library_dependencies = 6;
}
}
enum JobDevice {
JOB_DEVICE_FULL = 0;
JOB_DEVICE_FUSE = 1;
JOB_DEVICE_NULL = 2;
JOB_DEVICE_RANDOM = 3;
JOB_DEVICE_SHM = 4;
JOB_DEVICE_TTY = 5;
JOB_DEVICE_URANDOM = 6;
JOB_DEVICE_ZERO = 7;
}
message JobMount {
oneof Mount {
BindMount bind = 4;
DevicesMount devices = 7;
DevptsMount devpts = 5;
MqueueMount mqueue = 6;
ProcMount proc = 1;
SysMount sys = 3;
TmpMount tmp = 2;
}
}
message BindMount {
string mount_point = 1;
string local_path = 2;
bool read_only = 3;
}
message DevicesMount {
repeated JobDevice devices = 1;
}
message DevptsMount {
string mount_point = 1;
}
message MqueueMount {
string mount_point = 1;
}
message ProcMount {
string mount_point = 1;
}
message SysMount {
string mount_point = 1;
}
message TmpMount {
string mount_point = 1;
}
enum JobNetwork {
JOB_NETWORK_DISABLED = 0;
JOB_NETWORK_LOOPBACK = 1;
JOB_NETWORK_LOCAL = 2;
}
message CaptureFileSystemChanges {
string upper = 1;
string work = 2;
}
message EnvironmentSpec {
map<string, string> vars = 1;
bool extend = 2;
}
enum ImageUse {
IMAGE_USE_LAYERS = 0;
IMAGE_USE_ENVIRONMENT = 1;
IMAGE_USE_WORKING_DIRECTORY = 2;
}
message ImageRef {
string name = 1;
repeated ImageUse use = 2;
}
enum ContainerUse {
CONTAINER_USE_LAYERS = 0;
CONTAINER_USE_ENABLE_WRITABLE_FILE_SYSTEM = 1;
CONTAINER_USE_ENVIRONMENT = 2;
CONTAINER_USE_WORKING_DIRECTORY = 3;
CONTAINER_USE_MOUNTS = 4;
CONTAINER_USE_NETWORK = 5;
CONTAINER_USE_USER = 6;
CONTAINER_USE_GROUP = 7;
}
message ContainerRef {
string name = 1;
repeated ContainerUse use = 2;
}
message WindowSize {
uint32 rows = 1;
uint32 columns = 2;
}
message JobTty {
bytes socket_address = 1;
WindowSize window_size = 2;
}
message ContainerParent {
oneof parent {
ImageRef image = 1;
ContainerRef container = 2;
}
}
message ContainerSpec {
optional ContainerParent parent = 1;
repeated LayerSpec layers = 2;
optional bool enable_writable_file_system = 3;
repeated EnvironmentSpec environment = 4;
optional string working_directory = 5;
repeated JobMount mounts = 6;
optional JobNetwork network = 7;
optional uint32 user = 8;
optional uint32 group = 9;
}
message JobSpec {
ContainerSpec container = 1;
string program = 2;
repeated string arguments = 3;
optional uint32 timeout = 4;
optional Duration estimated_duration = 5;
optional JobTty allocate_tty = 6;
int32 priority = 7;
optional CaptureFileSystemChanges capture_file_system_changes = 8;
}
message RunJobRequest {
JobSpec spec = 1;
}
message Error {
string message_ = 1;
}
message JobError {
oneof kind {
string execution = 1;
string system = 2;
}
}
message JobOutputResultTruncated {
bytes first = 1;
uint64 truncated = 2;
}
message JobOutputResult {
oneof result {
Void none = 1;
bytes inline = 2;
JobOutputResultTruncated truncated = 3;
}
}
message Duration {
uint64 seconds = 1;
uint32 nano_seconds = 2;
}
message JobEffects {
JobOutputResult stdout = 1;
JobOutputResult stderr = 2;
Duration duration = 3;
}
message JobCompleted {
oneof status {
uint32 exited = 1;
uint32 signaled = 2;
}
JobEffects effects = 3;
}
message JobOutcome {
oneof outcome {
JobCompleted completed = 1;
JobEffects timed_out = 2;
}
}
message JobOutcomeResult {
oneof result {
JobError error = 1;
JobOutcome outcome = 2;
}
}
enum JobWorkerStatus {
JOB_WORKER_STATUS_WAITING_FOR_LAYERS = 0;
JOB_WORKER_STATUS_WAITING_TO_EXECUTE = 1;
JOB_WORKER_STATUS_EXECUTING = 2;
}
message JobBrokerAtWorkerStatus {
uint32 worker_id = 1;
JobWorkerStatus status = 2;
}
message JobBrokerStatus {
oneof status {
Void waiting_for_layers = 1;
Void waiting_for_worker = 2;
JobBrokerAtWorkerStatus at_worker = 3;
}
}
message JobRunningStatus {
oneof status {
JobBrokerStatus at_broker = 1;
JobWorkerStatus at_local_worker = 2;
}
}
message JobCompletedStatus {
uint32 client_job_id = 1;
JobOutcomeResult result = 2;
}
message JobStatus {
oneof status {
JobRunningStatus running = 1;
JobCompletedStatus completed = 2;
}
}
message Void {}
message RemoteProgress {
string name = 1;
uint64 size = 2;
uint64 progress = 3;
}
message IntrospectResponse {
repeated RemoteProgress artifact_uploads = 1;
repeated RemoteProgress image_downloads = 2;
}
enum LogLevel {
LOG_LEVEL_CRITICAL = 0;
LOG_LEVEL_ERROR = 1;
LOG_LEVEL_WARNING = 2;
LOG_LEVEL_INFO = 3;
LOG_LEVEL_DEBUG = 4;
LOG_LEVEL_TRACE = 5;
}
message LogKeyValue {
string key = 1;
string value = 2;
}
message LogMessage {
string message_ = 1;
LogLevel level = 2;
string tag = 3;
repeated LogKeyValue key_values = 4;
}
message AddContainerRequest {
string name = 1;
ContainerSpec container = 2;
}
service ClientProcess {
rpc StreamLogMessages(Void) returns (stream LogMessage);
rpc Start(StartRequest) returns (Void);
rpc AddContainer(AddContainerRequest) returns (Void);
rpc RunJob(RunJobRequest) returns (stream JobStatus);
rpc Introspect(Void) returns (IntrospectResponse);
rpc Stop(Void) returns (Void);
}