Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add query consistency params #170

Merged
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion .github/workflows/review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
- feat/abac
- feat/query-consistency-params
- feat/stronger-consistency

permissions:
contents: read
Expand Down
31 changes: 31 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.

27 changes: 27 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 higher consistency.
MINIMIZE_LATENCY = 1;
jimmyjames marked this conversation as resolved.
Show resolved Hide resolved
// Prefer higher consistency, at the potential expense of increased latency.
HIGHER_CONSISTENCY = 2;
}

jimmyjames marked this conversation as resolved.
Show resolved Hide resolved
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 is MINIMIZE_LATENCY.
jimmyjames marked this conversation as resolved.
Show resolved Hide resolved
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 is MINIMIZE_LATENCY.
ConsistencyPreference consistency = 8 [(validate.rules).enum.defined_only = true];
}

message ListUsersResponse {
Expand Down Expand Up @@ -985,6 +1003,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 is MINIMIZE_LATENCY.
ConsistencyPreference consistency = 5 [(validate.rules).enum.defined_only = true];
}

message ReadRequestTupleKey {
Expand Down Expand Up @@ -1109,6 +1130,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 is MINIMIZE_LATENCY.
ConsistencyPreference consistency = 7 [(validate.rules).enum.defined_only = true];
}

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

// Controls the consistency preference for this request. Default is MINIMIZE_LATENCY.
ConsistencyPreference consistency = 4 [(validate.rules).enum.defined_only = true];
}

message ExpandRequestTupleKey {
Expand Down
Loading
Loading