Skip to content

Commit

Permalink
Entry names
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper committed Apr 15, 2024
1 parent 29b28f9 commit 8edf6a4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
40 changes: 39 additions & 1 deletion dev/restate/service/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ message ErrorMessage {
string message = 2;
// Contains a verbose error description, e.g. the exception stacktrace.
string description = 3;

// Last entry name. Empty if no name was set.
string last_entry_name = 4;
}

// Type: 0x0000 + 4
Expand All @@ -96,7 +99,7 @@ message EndMessage {
// * bytes value = 14 for carrying the result value
// * Failure failure = 15 for carrying a failure
//
// The tag numbers 13, 14 and 15 are reserved and shouldn't be used for other fields.
// The tag numbers 12, 13, 14 and 15 are reserved and shouldn't be used for other fields.

// ------ Input and output ------

Expand All @@ -107,6 +110,9 @@ message InputEntryMessage {
repeated Header headers = 1;

bytes value = 14;

// Entry name
string name = 12;
}

// Completable: No
Expand All @@ -117,6 +123,9 @@ message OutputEntryMessage {
bytes value = 14;
Failure failure = 15;
};

// Entry name
string name = 12;
}

// ------ State access ------
Expand All @@ -132,6 +141,9 @@ message GetStateEntryMessage {
bytes value = 14;
Failure failure = 15;
};

// Entry name
string name = 12;
}

// Completable: No
Expand All @@ -140,19 +152,27 @@ message GetStateEntryMessage {
message SetStateEntryMessage {
bytes key = 1;
bytes value = 3;

// Entry name
string name = 12;
}

// Completable: No
// Fallible: No
// Type: 0x0800 + 2
message ClearStateEntryMessage {
bytes key = 1;

// Entry name
string name = 12;
}

// Completable: No
// Fallible: No
// Type: 0x0800 + 3
message ClearAllStateEntryMessage {
// Entry name
string name = 12;
}

// Completable: Yes
Expand All @@ -167,6 +187,9 @@ message GetStateKeysEntryMessage {
StateKeys value = 14;
Failure failure = 15;
};

// Entry name
string name = 12;
}

// ------ Syscalls ------
Expand All @@ -183,6 +206,9 @@ message SleepEntryMessage {
Empty empty = 13;
Failure failure = 15;
}

// Entry name
string name = 12;
}

// Completable: Yes
Expand All @@ -203,6 +229,9 @@ message InvokeEntryMessage {
bytes value = 14;
Failure failure = 15;
};

// Entry name
string name = 12;
}

// Completable: No
Expand All @@ -224,6 +253,9 @@ message BackgroundInvokeEntryMessage {

// If this invocation has a key associated (e.g. for objects and workflows), then this key is filled in. Empty otherwise.
string key = 6;

// Entry name
string name = 12;
}

// Completable: Yes
Expand All @@ -235,6 +267,9 @@ message AwakeableEntryMessage {
bytes value = 14;
Failure failure = 15;
};

// Entry name
string name = 12;
}

// Completable: No
Expand All @@ -248,6 +283,9 @@ message CompleteAwakeableEntryMessage {
bytes value = 5;
Failure failure = 6;
};

// Entry name
string name = 12;
}

// --- Nested messages
Expand Down
10 changes: 10 additions & 0 deletions service-invocation-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ index of the corresponding entry.
| Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

#### Entry names

Every Journal entry has a field `string name = 12`, which can be set by the SDK when recording the entry. This field is
used for observability purposes by Restate observability tools.

### Journal entries reference

The following tables describe the currently available journal entries. For more details, check the protobuf message
Expand Down Expand Up @@ -365,6 +370,11 @@ additional features to the users.
The protocol allows the SDK to register an arbitrary entry type within the journal. The type MUST be `>= 0xFC00`. The
runtime will treat this entry as any other entry, persisting it and sending it during replay in the correct order.

Custom entries MAY have the entry name field `12`, as described in [entry names](#entry-names).

The field numbers 13, 14 and 15 MUST not be used, as they're reserved for completable journal entries, as described in
[completable journal entries](#completable-journal-entries-and-completionmessage).

**Header**

0 1 2 3
Expand Down

0 comments on commit 8edf6a4

Please sign in to comment.