syntax = "proto3"; import "google/protobuf/timestamp.proto"; import "google/protobuf/duration.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); rpc ListExecutionEvents(ListExecutionEventsRequest) returns (ListExecutionEventsResponse); rpc ListResponses (ListResponsesRequest) returns (ListResponsesResponse); } service FunctionRepository { rpc ListComponents(ListComponentsRequest) returns (ListComponentsResponse); } message ListExecutionsRequest { message Cursor { oneof cursor { ExecutionId execution_id = 1; google.protobuf.Timestamp created_at = 2; } } message NewerThan { uint32 length = 1; Cursor cursor = 2; bool including_cursor = 3; } message OlderThan { uint32 length = 1; Cursor cursor = 2; bool including_cursor = 3; } optional FunctionName function_name = 1; oneof pagination { // latest by `created_at` if not set NewerThan newer_than = 3; OlderThan older_than = 4; }; } message ExecutionSummary { ExecutionId execution_id = 1; FunctionName function_name = 2; ExecutionStatus current_status = 3; google.protobuf.Timestamp created_at = 4; google.protobuf.Timestamp scheduled_at = 5; } message ListExecutionsResponse { repeated ExecutionSummary executions = 3; } message ListComponentsRequest { optional FunctionName function = 1; // FIXME: function_name 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 FunctionDetail exports = 6; // Functions are sorted by their interface name repeated FunctionDetail imports = 7; // Functions are sorted by their interface name } enum ComponentType { WORKFLOW = 0; ACTIVITY_WASM = 1; WEBHOOK_WASM = 2; } message FunctionDetail { FunctionName function = 1; // FIXME: function_name 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; reserved 2; } message ExecutionId { string id = 1; } message RunId { string id = 1; } message JoinSetId { string id = 1; } message DelayId { 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; // FIXME: function_name 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.Timestamp created_at = 1; google.protobuf.Timestamp scheduled_at = 2; google.protobuf.Timestamp finished_at = 3; ResultDetail result_detail = 4; } message ResultDetail { message Ok { optional google.protobuf.Any return_value = 1; } message Timeout { } message NondeterminismDetected { string reason = 1; } message ExecutionFailure { string reason = 1; } message FallibleError { // The top level JSON attribute "err" must be present. google.protobuf.Any return_value = 1; } oneof value { Ok ok = 1; FallibleError fallible_error = 2; Timeout timeout = 3; NondeterminismDetected nondeterminism_detected = 4; ExecutionFailure execution_failure = 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; } } message ExecutionEvent { message Created { FunctionName function_name = 1; google.protobuf.Any params = 2; google.protobuf.Timestamp scheduled_at = 3; string config_id = 4; optional ExecutionId scheduled_by = 5; } message Locked { string config_id = 1; string run_id = 4; google.protobuf.Timestamp lock_expires_at = 3; } message Unlocked {} message TemporarilyFailed { string reason = 1; google.protobuf.Timestamp backoff_expires_at = 2; } message TemporarilyTimedOut { google.protobuf.Timestamp backoff_expires_at = 1; } message Finished { ResultDetail result_detail = 1; } message HistoryEvent { message Persist { google.protobuf.Any data = 1; } message JoinSetCreated { JoinSetId join_set_id = 1; } message JoinSetRequest { message DelayRequest { DelayId delay_id = 1; google.protobuf.Timestamp expires_at = 2; } message ChildExecutionRequest { ExecutionId child_execution_id = 1; } JoinSetId join_set_id = 1; oneof join_set_request { DelayRequest delay_request = 2; ChildExecutionRequest child_execution_request = 3; } } message JoinNext { JoinSetId join_set_id = 1; google.protobuf.Timestamp run_expires_at = 2; bool closing = 3; } message Schedule { message ScheduledAt { message Now {} message At { google.protobuf.Timestamp at = 1; } message In { google.protobuf.Duration in = 1; } oneof variant { Now now = 1; At at = 2; In in = 3; } } ExecutionId execution_id = 1; ScheduledAt scheduled_at = 2; } oneof event { Persist persist = 1; JoinSetCreated join_set_created = 2; JoinSetRequest join_set_request = 3; JoinNext join_next = 4; Schedule schedule = 5; } } google.protobuf.Timestamp created_at = 1; uint32 version = 2; oneof event { Created created = 3; Locked locked = 4; Unlocked unlocked = 5; TemporarilyFailed failed = 6; TemporarilyTimedOut timed_out = 7; Finished finished = 8; HistoryEvent history_variant = 9; } } message ListExecutionEventsRequest { ExecutionId execution_id = 1; uint32 version_from = 2; // 0 to request the first page uint32 length = 3; } message ListExecutionEventsResponse { repeated ExecutionEvent events = 2; } message JoinSetResponseEvent { message DelayFinished { DelayId delay_id = 1; } message ChildExecutionFinished { ExecutionId child_execution_id = 1; ResultDetail result_detail = 2; } google.protobuf.Timestamp created_at = 1; JoinSetId join_set_id = 2; oneof response { DelayFinished delay_finished = 3; ChildExecutionFinished child_execution_finished = 4; } } message ResponseWithCursor { JoinSetResponseEvent event = 1; uint32 cursor = 2; } message ListResponsesRequest { ExecutionId execution_id = 1; uint32 cursor_from = 2; // 0 to request the first page uint32 length = 3; bool including_cursor = 4; // true to request the first page } message ListResponsesResponse { repeated ResponseWithCursor responses = 1; }