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

Introduce service.Version and discovery.Version enums #93

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
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
22 changes: 22 additions & 0 deletions dev/restate/service/discovery.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2024 - Restate Software, Inc., Restate GmbH
//
// This file is part of the Restate service protocol, which is
// released under the MIT license.
//
// You can find a copy of the license in file LICENSE in the root
// directory of this repository or package, or at
// https://github.com/restatedev/service-protocol/blob/main/LICENSE

syntax = "proto3";

package dev.restate.service.discovery;

option java_package = "dev.restate.generated.service.discovery";
option go_package = "restate.dev/sdk-go/pb/service/discovery";

// Service discovery protocol version.
enum ServiceDiscoveryProtocolVersion {
SERVICE_DISCOVERY_PROTOCOL_VERSION_UNSPECIFIED = 0;
// initial service discovery protocol version using endpoint_manifest_schema.json
V1 = 1;
}
9 changes: 8 additions & 1 deletion dev/restate/service/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ package dev.restate.service.protocol;
option java_package = "dev.restate.generated.service.protocol";
option go_package = "restate.dev/sdk-go/pb/service/protocol";

// Service protocol version.
enum ServiceProtocolVersion {
SERVICE_PROTOCOL_VERSION_UNSPECIFIED = 0;
// initial service protocol version
V1 = 1;
}

// --- Core frames ---

// Type: 0x0000 + 0
Expand Down Expand Up @@ -381,4 +388,4 @@ message Header {
}

message Empty {
}
}
6 changes: 4 additions & 2 deletions endpoint_manifest_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
},
"minProtocolVersion": {
"type": "integer",
"minimum": 0,
"minimum": 1,
"maximum": 2147483647,
"description": "Minimum supported protocol version"
},
"maxProtocolVersion": {
"type": "integer",
"maximum": 0,
"minimum": 1,
"maximum": 2147483647,
"description": "Maximum supported protocol version"
},
"services": {
Expand Down
10 changes: 8 additions & 2 deletions service-invocation-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,16 @@ replying back with a `404` status code.

#### Content type and protocol version

The request contains the content-type `application/vnd.restate.invocation.vX` where `vX` is the protocol version chosen
by the runtime, e.g.:
The request contains the content-type `application/vnd.restate.invocation.vX` where `X` is the service protocol version
chosen by the runtime, e.g.:

```http request
content-type: application/vnd.restate.invocation.v1
```

The service protocol version is defined by `ServiceProtocolVersion` in
[`protocol.proto`](dev/restate/service/protocol.proto).

The SDK MUST return back the same content-type in the successful response case. If the SDK doesn't support the
content-type, It SHOULD close the stream replying back with a `415` status code.

Expand Down Expand Up @@ -426,6 +429,9 @@ When replying, the content-type MUST contain the chosen endpoint manifest type/v
content-type: application/vnd.restate.endpointmanifest.v1+json
```

The service discovery protocol version is defined by `ServiceDiscoveryProtocolVersion` in
[`discovery.proto`](dev/restate/service/discovery.proto).

## Optional features

The following section describes optional features SDK developers MAY implement to improve the experience and provide
Expand Down
Loading