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

Commit

Permalink
GetStateKeysEntryMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper committed Feb 7, 2024
1 parent 6cdc9e0 commit 038b533
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
14 changes: 14 additions & 0 deletions dev/restate/service/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ message ClearStateEntryMessage {
bytes key = 1;
}

// Completable: Yes
// Fallible: No
// Type: 0x0800 + 4
message GetStateKeysEntryMessage {
message StateKeys {
repeated bytes keys = 1;
}

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

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

// Completable: Yes
Expand Down
14 changes: 8 additions & 6 deletions service-invocation-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ Each syscall defines a priori whether it replies with an ack or a completion, or

## Messages

The protocol is composed by messages that are sent back and forth between runtime and the service deployment. The protocol
mandates the following messages:
The protocol is composed by messages that are sent back and forth between runtime and the service deployment. The
protocol mandates the following messages:

- `StartMessage`
- `[..]EntryMessage`
Expand Down Expand Up @@ -284,6 +284,7 @@ descriptions in [`protocol.proto`](dev/restate/service/protocol.proto).
| ------------------------------- | -------- | ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PollInputStreamEntryMessage` | `0x0400` | Yes | No | Carries the invocation input message(s) of the invocation. Note: currently the runtime always sends this entry completed, but this may change in future. |
| `GetStateEntryMessage` | `0x0800` | Yes | No | Get the value of a service instance state key. |
| `GetStateKeysEntryMessage` | `0x0804` | Yes | No | Get all the known state keys for this service instance. Note: the completion value for this message is a protobuf of type `GetStateKeysEntryMessage.StateKeys`. |
| `SleepEntryMessage` | `0x0C00` | Yes | No | Initiate a timer that completes after the given time. |
| `InvokeEntryMessage` | `0x0C01` | Yes | Yes | Invoke another Restate service. |
| `AwakeableEntryMessage` | `0x0C03` | Yes | No | Arbitrary result container which can be completed from another service, given a specific id. See [Awakeable identifier](#awakeable-identifier) for more details. |
Expand All @@ -298,8 +299,9 @@ descriptions in [`protocol.proto`](dev/restate/service/protocol.proto).
When creating an `AwakeableEntryMessage`, the SDK MUST expose to the user code an id, required to later complete the
entry, using either `CompleteAwakeableEntryMessage` or some other mechanism provided by the runtime.

The id format is a string starts with `prom_1` concatenated with a [Base64 URL Safe string](https://datatracker.ietf.org/doc/html/rfc4648#section-5) encoding of a byte
array that concatenates:
The id format is a string starts with `prom_1` concatenated with a
[Base64 URL Safe string](https://datatracker.ietf.org/doc/html/rfc4648#section-5) encoding of a byte array that
concatenates:

- `StartMessage.id`
- The index of the Awakeable entry, encoded as unsigned 32 bit integer big endian.
Expand Down Expand Up @@ -331,8 +333,8 @@ To notify a failure, the SDK can either:

- Close the stream with `ErrorMessage` as last message. This message is used by the runtime for accurate reporting to
the user.
- Close the stream without `EndMessage` or `SuspensionMessage` or `ErrorMessage`. This is equivalent to sending
an `ErrorMessage` with unknown reason.
- Close the stream without `EndMessage` or `SuspensionMessage` or `ErrorMessage`. This is equivalent to sending an
`ErrorMessage` with unknown reason.

The runtime takes care of retrying to execute the invocation after such failures occur, following a defined set of
policies. When retrying, the previous stored journal will be reused. Moreover, the SDK MUST NOT assume that every
Expand Down

0 comments on commit 038b533

Please sign in to comment.