Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Add Ingress.IdempotentInvoke #28

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 51 additions & 5 deletions dev/restate/services.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,27 @@ service Ingress {
// Invoke a service and don't wait for the response.
// It is guaranteed that the service will be invoked after this method returns.
rpc Invoke(InvokeRequest) returns (InvokeResponse);

// Invoke a service in an idempotent fashion.
// If already invoked, this will return the cached response.
// The response will be cleaned up after a retention period.
rpc IdempotentInvoke(IdempotentInvokeRequest) returns (IdempotentInvokeResponse);
}

message InvokeRequest {
// Fully qualified name of the service, e.g. `counter.Counter`
string service = 1;

// Method name of the service to invoke, e.g. `Add`
string method = 2;

// Argument of the invocation.
// When executing requests to the ingress using Protobuf,
// this field must contain the serialized Protobuf matching the argument type of the target method.
// When executing requests to the ingress using JSON,
// this field must contain the JSON object representing the argument type of the target method.
bytes argument = 3;
// You can pass the invocation argument either as protobuf or as JSON.
// In case of JSON, the argument will be automatically transcoded to protobuf.
oneof argument {
bytes pb = 3;
google.protobuf.Struct json = 4 [json_name = "argument"];
}
}

message InvokeResponse {
Expand All @@ -46,6 +54,44 @@ message InvokeResponse {
string id = 1;
}

message IdempotentInvokeRequest {
// Idempotency id.
string idempotency_id = 1;

// Fully qualified name of the service, e.g. `counter.Counter`
string service = 2;

// Method name of the service to invoke, e.g. `Add`
string method = 3;

// Argument of the invocation.
// You can pass the invocation argument either as protobuf or as JSON.
// In case of JSON, the argument will be automatically transcoded to protobuf.
oneof argument {
bytes pb = 4;
google.protobuf.Struct json = 5 [json_name = "argument"];
}

// Retention period for the response in seconds.
// After the invocation completes, the response will be persisted for the given duration.
// Afterwards, the system will cleanup the response and treats any subsequent invocation with same id as new.
//
// If not set, 30 minutes will be used as retention period.
uint32 retention_period_sec = 6;
}

message IdempotentInvokeResponse {
// Invocation response.
// The response will be provided in the same format used for the request.
oneof response {
bytes pb = 1;
google.protobuf.Struct json = 2 [json_name = "response"];
}

// Timestamp of the response expiry time in RFC3339.
string expiry_time = 3;
}

service Awakeables {
// Resolve an Awakeable with a result value.
rpc Resolve(ResolveAwakeableRequest) returns (google.protobuf.Empty);
Expand Down