Skip to content
This repository has been archived by the owner on Feb 14, 2025. It is now read-only.

Commit

Permalink
Workflow api changes (#91)
Browse files Browse the repository at this point in the history
* Add workflow service type and handler type
* Add promise operations
  • Loading branch information
slinkydeveloper authored May 15, 2024
1 parent 1fa71a5 commit 2f3e461
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
54 changes: 54 additions & 0 deletions dev/restate/service/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,60 @@ message GetStateKeysEntryMessage {
string name = 12;
}

// Completable: Yes
// Fallible: No
// Type: 0x0800 + 8
message GetPromiseEntryMessage {
string key = 1;

oneof result {
bytes value = 14;
Failure failure = 15;
};

// Entry name
string name = 12;
}

// Completable: Yes
// Fallible: No
// Type: 0x0800 + 9
message PeekPromiseEntryMessage {
string key = 1;

oneof result {
Empty empty = 13;
bytes value = 14;
Failure failure = 15;
};

// Entry name
string name = 12;
}

// Completable: Yes
// Fallible: No
// Type: 0x0800 + A
message CompletePromiseEntryMessage {
string key = 1;

// The value to use to complete the promise
oneof completion {
bytes completion_value = 2;
Failure completion_failure = 3;
};

oneof result {
// Returns empty if value was set successfully
Empty empty = 13;
// Returns a failure if the promise was already completed
Failure failure = 15;
}

// Entry name
string name = 12;
}

// ------ Syscalls ------

// Completable: Yes
Expand Down
6 changes: 3 additions & 3 deletions endpoint_manifest_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"ty": {
"title": "ServiceType",
"enum": ["VIRTUAL_OBJECT", "SERVICE"]
"enum": ["VIRTUAL_OBJECT", "SERVICE", "WORKFLOW"]
},
"handlers": {
"type": "array",
Expand All @@ -45,8 +45,8 @@
},
"ty": {
"title": "HandlerType",
"enum": ["EXCLUSIVE", "SHARED"],
"description": "If unspecified, defaults to EXCLUSIVE for Virtual Object. This should be unset for Services."
"enum": ["WORKFLOW", "EXCLUSIVE", "SHARED"],
"description": "If unspecified, defaults to EXCLUSIVE for Virtual Object or WORKFLOW for Workflows. This should be unset for Services."
},
"input": {
"type": "object",
Expand Down
3 changes: 3 additions & 0 deletions service-invocation-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ descriptions in [`protocol.proto`](dev/restate/service/protocol.proto).
| `ClearStateEntryMessage` | `0x0801` | No | No | Clear the value of a service instance state key. |
| `ClearAllStateEntryMessage` | `0x0802` | No | No | Clear all the values of the service instance state. |
| `RunEntryMessage` | `0x0C05` | No | No | Run non-deterministic user provided code and persist the result. |
| `GetPromiseEntryMessage` | `0x0808` | Yes | No | Get or wait the value of the given promise. If the value is not present yet, this entry will block waiting for the value. |
| `PeekPromiseEntryMessage` | `0x0809` | Yes | No | Get the value of the given promise. If the value is not present, this entry completes immediately with empty completion. |
| `CompletePromiseEntryMessage` | `0x080A` | Yes | No | Complete the given promise. If the promise was completed already, this entry completes with a failure. |

#### Awakeable identifier

Expand Down

0 comments on commit 2f3e461

Please sign in to comment.