Skip to content

Commit 9b0ee43

Browse files
authored
feat: add sync stream type and context (#183)
This PR updates the sync schema. It: - deprecates the [GetMetadata](https://buf.build/open-feature/flagd/docs/main:flagd.sync.v1#flagd.sync.v1.FlagSyncService.GetMetadata) rpc and its messages - includes a new, **_optional_** `sync_context` field which conveys the same data as the now-deprecated GetMetadata rpc - `optional` makes it easy for providers to absorb this change in a non-breaking way, since it generates code which allows us to check if the the field is explicitly set or not, and if not, fall back to the old GetMetadata - ~includes a new, **_required_** `type` field, exactly equivalent to the~ `type` field in the [EventStream](https://buf.build/open-feature/flagd/docs/main:flagd.evaluation.v1#flagd.evaluation.v1.EventStreamResponse) - this field must contain `provider_ready` on the first stream payload, and `configuration_change` in subsequent payloads - this field is required, **_meaning this is a breaking change for servers_** (they will need to be updated to check this field) - this allows providers to commonize more logic between sync/event stream implementations, and remove some state maintenance associated with sync stream implementations Relates to: open-feature/flagd#1584 Relates to: open-feature/flagd#1585 In general, I'm wondering what people think of the name `sync_context` for the new field carrying the static context from flagd. My argument for `sync_context` is simple, in that it carries the auxiliary context from server and it's delivered via the sync stream. `static_context` might also work, but it might not be "static" in some implementations and could change in a new stream payload (though it won't in flagd). `GetMetadata` was poorly named, and I'm hoping this is clearer. @cupofcat I believe you have your own server implementation, so I'm interested in your thoughts on both these changes. --------- Signed-off-by: Todd Baert <[email protected]>
1 parent e840a03 commit 9b0ee43

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

protobuf/flagd/sync/v1/sync.proto

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ message SyncFlagsRequest {
3737
message SyncFlagsResponse {
3838
// flagd feature flag configuration. Must be validated to schema - https://raw.githubusercontent.com/open-feature/flagd-schemas/main/json/flags.json
3939
string flag_configuration = 1;
40+
// Static context to be included in in-process evaluations (optional).
41+
optional google.protobuf.Struct sync_context = 2;
4042
}
4143

4244
// FetchAllFlagsRequest is the request to fetch all flags. Clients send this request as the client in order to resync their internal state
@@ -62,17 +64,23 @@ message FetchAllFlagsResponse {
6264
}
6365

6466
// GetMetadataRequest is the request for retrieving metadata from the sync service
65-
message GetMetadataRequest {}
67+
message GetMetadataRequest {
68+
option deprecated = true;
69+
}
6670

6771
// GetMetadataResponse contains metadata from the sync service
72+
// DEPRECATED; use flagd.sync.v1.SyncFlagsResponse.sync_context
6873
message GetMetadataResponse {
6974
reserved 1; // old key/value metadata impl
7075
google.protobuf.Struct metadata = 2;
76+
option deprecated = true;
7177
}
7278

7379
// FlagService implements a server streaming to provide realtime flag configurations
7480
service FlagSyncService {
7581
rpc SyncFlags(SyncFlagsRequest) returns (stream SyncFlagsResponse) {}
7682
rpc FetchAllFlags(FetchAllFlagsRequest) returns (FetchAllFlagsResponse) {}
77-
rpc GetMetadata(GetMetadataRequest) returns (GetMetadataResponse) {}
83+
rpc GetMetadata(GetMetadataRequest) returns (GetMetadataResponse) {
84+
option deprecated = true;
85+
}
7886
}

0 commit comments

Comments
 (0)