Skip to content

Commit

Permalink
feat: add query consistency params (#180)
Browse files Browse the repository at this point in the history
* setup feat/stronger-consistency branch

* feat: add query consistency params (#170)

* feat: add consistency enum parameter for query APIs

* fix CI workflow branch name

* ignore enum suffix lint rule

* ignore enum val prefix lint warning

* fix up generated files

* docs formatting fix

* review feedback: update enum vals for future additions, update docs

* fix up docs clarification for all endpoints

* feat: add consistency options to StreamedListObjects

* doc: correct consistency reference in doc string (#182)

* doc: correct consistency reference in doc string

* chore: remove dx from codeowners as we're moving off feature branch

* Merge main int feat/stronger-consistency-options (#184)

ci: don't pin version of buf (#181)

* ci: don't pin version of buf

Instead we will use the version that correlates to the action version

* chore(deps): update buf-setup-action version

* style: run buf format to make formatting changes

---------

Co-authored-by: Jim Anderson <[email protected]>
Co-authored-by: Raghd Hamzeh <[email protected]>
  • Loading branch information
3 people authored Jul 23, 2024
1 parent a9261bb commit 7e5be7b
Show file tree
Hide file tree
Showing 4 changed files with 2,526 additions and 2,242 deletions.
35 changes: 35 additions & 0 deletions docs/openapiv2/apidocs.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions openfga/v1/openfga_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,18 @@ service OpenFGAService {
}
}

// Controls the consistency preferences when calling the query APIs.
// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
// buf:lint:ignore ENUM_VALUE_PREFIX
enum ConsistencyPreference {
// Default if not set. Behavior will be the same as MINIMIZE_LATENCY
UNSPECIFIED = 0;
// Minimize latency at the potential expense of lower consistency.
MINIMIZE_LATENCY = 100;
// Prefer higher consistency, at the potential expense of increased latency.
HIGHER_CONSISTENCY = 200;
}

message ListObjectsRequest {
string store_id = 1 [
json_name = "store_id",
Expand Down Expand Up @@ -821,6 +833,9 @@ message ListObjectsRequest {
// Additional request context that will be used to evaluate any ABAC conditions encountered
// in the query evaluation.
google.protobuf.Struct context = 7;

// Controls the consistency preference for this request. Default value is UNSPECIFIED, which will have the same behavior as MINIMIZE_LATENCY.
ConsistencyPreference consistency = 8 [(validate.rules).enum.defined_only = true];
}

message ListObjectsResponse {
Expand Down Expand Up @@ -883,6 +898,9 @@ message ListUsersRequest {
// Additional request context that will be used to evaluate any ABAC conditions encountered
// in the query evaluation.
google.protobuf.Struct context = 7;

// Controls the consistency preference for this request. Default value is UNSPECIFIED, which will have the same behavior as MINIMIZE_LATENCY.
ConsistencyPreference consistency = 8 [(validate.rules).enum.defined_only = true];
}

message ListUsersResponse {
Expand Down Expand Up @@ -940,6 +958,9 @@ message StreamedListObjectsRequest {
// Additional request context that will be used to evaluate any ABAC conditions encountered
// in the query evaluation.
google.protobuf.Struct context = 7;

// Controls the consistency preference for this request. Default value is UNSPECIFIED, which will have the same behavior as MINIMIZE_LATENCY.
ConsistencyPreference consistency = 8 [(validate.rules).enum.defined_only = true];
}

// The response for a StreamedListObjects RPC.
Expand Down Expand Up @@ -979,6 +1000,9 @@ message ReadRequest {
(validate.rules).string.max_bytes = 5120,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {example: "\"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\""}
];

// Controls the consistency preference for this request. Default value is UNSPECIFIED, which will have the same behavior as MINIMIZE_LATENCY.
ConsistencyPreference consistency = 5 [(validate.rules).enum.defined_only = true];
}

message ReadRequestTupleKey {
Expand Down Expand Up @@ -1103,6 +1127,9 @@ message CheckRequest {
// Additional request context that will be used to evaluate any ABAC conditions encountered
// in the query evaluation.
google.protobuf.Struct context = 6;

// Controls the consistency preference for this request. Default value is UNSPECIFIED, which will have the same behavior as MINIMIZE_LATENCY.
ConsistencyPreference consistency = 7 [(validate.rules).enum.defined_only = true];
}

message CheckRequestTupleKey {
Expand Down Expand Up @@ -1163,6 +1190,9 @@ message ExpandRequest {
},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {example: "\"01G5JAVJ41T49E9TT3SKVS7X1J\""}
];

// Controls the consistency preference for this request. Default value is UNSPECIFIED, which will have the same behavior as MINIMIZE_LATENCY.
ConsistencyPreference consistency = 4 [(validate.rules).enum.defined_only = true];
}

message ExpandRequestTupleKey {
Expand Down
Loading

0 comments on commit 7e5be7b

Please sign in to comment.