syntax = "proto3"; import "google/protobuf/timestamp.proto"; import "google/protobuf/any.proto"; package obelisk; service ExecutionRepository { rpc Submit(SubmitRequest) returns (SubmitResponse); rpc GetStatus(GetStatusRequest) returns (stream GetStatusResponse); rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse); } service FunctionRepository { rpc ListComponents(ListComponentsRequest) returns (ListComponentsResponse); } message ListExecutionsRequest { message Oldest { uint32 oldest = 1; } message NewerThan { uint32 next = 1; ExecutionId cursor = 2; bool including_cursor = 3; } message Latest { uint32 latest = 1; } message OlderThan { uint32 previous = 1; ExecutionId cursor = 2; bool including_cursor = 3; } optional FunctionName function_name = 1; oneof pagination { Oldest oldest = 2; NewerThan newer_than = 3; Latest latest = 4; OlderThan older_than = 5; } } message ExecutionSummary { ExecutionId execution_id = 1; FunctionName function_name = 2; ExecutionStatus current_status = 3; } message ListExecutionsResponse { repeated ExecutionSummary executions = 1; } message ListComponentsRequest { optional FunctionName function = 1; optional ConfigId config_id = 2; bool extensions = 3; } message ListComponentsResponse { repeated Component components = 1; } message Component { ConfigId config_id = 1; string digest = 2; string name = 3; ComponentType type = 4; reserved 5; repeated FunctionDetails exports = 6; // Functions are sorted by their interface name repeated FunctionDetails imports = 7; // Functions are sorted by their interface name } enum ComponentType { WORKFLOW = 0; ACTIVITY_WASM = 1; WEBHOOK_WASM = 2; } message FunctionDetails { // FIXME: Rename to FunctionDetail FunctionName function = 1; repeated FunctionParameter params = 2; optional WitType return_type = 3; optional FunctionExtension extension = 4; bool submittable = 5; } enum FunctionExtension { SUBMIT = 0; AWAIT_NEXT = 1; SCHEDULE = 2; } message FunctionParameter { WitType type = 1; optional string name = 2; } message WitType { optional string wit_type = 1; google.protobuf.Any internal = 2; } message ExecutionId { string id = 1; } message RunId { string id = 1; } message JoinSetId { string id = 1; } // Identifier for given configuration. // Uniqueness is not guaranteed. // The id is not persisted, only appears in logs and traces and gRPC responses. message ConfigId { string id = 1; } message FunctionName { // `namespace:pkg_name/ifc_name` or `namespace:pkg_name/ifc_name@version` string interface_name = 1; string function_name = 2; } message SubmitRequest { FunctionName function = 1; google.protobuf.Any params = 2; reserved 3; reserved 4; } message SubmitResponse { ExecutionId execution_id = 1; } message GetStatusRequest { ExecutionId execution_id = 1; bool follow = 2; bool send_finished_status = 3; } enum ResultKind { OK = 0; TIMEOUT = 1; NONDETERMINISM_DETECTED = 2; EXECUTION_FAILURE = 3; FALLIBLE_ERROR = 4; } message ExecutionStatus { message Locked { RunId run_id = 2; google.protobuf.Timestamp lock_expires_at = 3; } message PendingAt { google.protobuf.Timestamp scheduled_at = 1; } message BlockedByJoinSet { JoinSetId join_set_id = 1; google.protobuf.Timestamp lock_expires_at = 2; bool closing = 3; } message Finished { reserved 1; reserved 2; reserved 3; google.protobuf.Timestamp finished_at = 4; ResultKind result_kind = 5; } oneof status { Locked locked = 1; PendingAt pending_at = 2; BlockedByJoinSet blocked_by_join_set = 3; Finished finished = 4; } } message FinishedStatus { google.protobuf.Any result = 1; google.protobuf.Timestamp created_at = 2; reserved 3; google.protobuf.Timestamp finished_at = 4; ResultKind result_kind = 5; } message GetStatusResponse { oneof message { // First message in the stream ExecutionSummary summary = 1; // Remaining messages ExecutionStatus current_status = 2; // Finished status FinishedStatus finished_status = 3; } }