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

Changes to the relationships counter API after discussion #107

Merged
merged 1 commit into from
May 22, 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
16 changes: 8 additions & 8 deletions authzed/api/v1/error_reason.proto
Original file line number Diff line number Diff line change
Expand Up @@ -365,25 +365,25 @@
// }
ERROR_REASON_EMPTY_PRECONDITION = 25;

// The request failed because the filter was already registered.
// The request failed because the counter was already registered.
//
// Example of an ErrorInfo:
//
// {
// "reason": "ERROR_REASON_FILTER_ALREADY_REGISTERED",
// "reason": "ERROR_REASON_COUNTER_ALREADY_REGISTERED",
// "domain": "authzed.com",
// "metadata": { ... filter fields ... }
// "metadata": { "counter_name": "name" }
// }
ERROR_REASON_FILTER_ALREADY_REGISTERED = 26;
ERROR_REASON_COUNTER_ALREADY_REGISTERED = 26;

Check failure on line 377 in authzed/api/v1/error_reason.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Enum value "26" on enum "ErrorReason" changed name from "ERROR_REASON_FILTER_ALREADY_REGISTERED" to "ERROR_REASON_COUNTER_ALREADY_REGISTERED".

// The request failed because the filter was not registered.
// The request failed because the counter was not registered.
//
// Example of an ErrorInfo:
//
// {
// "reason": "ERROR_REASON_FILTER_NOT_REGISTERED",
// "reason": "ERROR_REASON_COUNTER_NOT_REGISTERED",
// "domain": "authzed.com",
// "metadata": { ... filter fields ... }
// "metadata": { "counter_name": "name" }
// }
ERROR_REASON_FILTER_NOT_REGISTERED = 27;
ERROR_REASON_COUNTER_NOT_REGISTERED = 27;

Check failure on line 388 in authzed/api/v1/error_reason.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Enum value "27" on enum "ErrorReason" changed name from "ERROR_REASON_FILTER_NOT_REGISTERED" to "ERROR_REASON_COUNTER_NOT_REGISTERED".
}
47 changes: 31 additions & 16 deletions authzed/api/v1/experimental_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -129,37 +129,52 @@
}

message ExperimentalRegisterRelationshipCounterRequest {
// name is the name of the counter being registered.
string name = 1[ (validate.rules).string = {

Check failure on line 133 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "1" with name "name" on message "ExperimentalRegisterRelationshipCounterRequest" changed option "json_name" from "relationshipFilter" to "name".

Check failure on line 133 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "1" on message "ExperimentalRegisterRelationshipCounterRequest" changed type from "message" to "string". See https://developers.google.com/protocol-buffers/docs/proto3#updating for wire compatibility rules and https://developers.google.com/protocol-buffers/docs/proto3#json for JSON compatibility rules.

Check failure on line 133 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "1" on message "ExperimentalRegisterRelationshipCounterRequest" changed name from "relationship_filter" to "name".
pattern : "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$",
max_bytes : 64,
} ];

// relationship_filter defines the filter to be applied to the relationships
// to be counted.
RelationshipFilter relationship_filter = 1
RelationshipFilter relationship_filter = 2
[ (validate.rules).message.required = true ];
}

message ExperimentalRegisterRelationshipCounterResponse {}

message ExperimentalCountRelationshipsRequest {

Check failure on line 146 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Previously present field "2" with name "relationship_filter" on message "ExperimentalCountRelationshipsRequest" was deleted without reserving the name "relationship_filter".

Check failure on line 146 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Previously present field "2" with name "relationship_filter" on message "ExperimentalCountRelationshipsRequest" was deleted without reserving the number "2".
// consistency defines the consistency level for the count operation. If the
// requested consistency is fully consistent or represents a zedtoken that is
// not stored in the system, the count will be performed synchronously, which
// can be *quite slow* for large datasets.
Consistency consistency = 1;

// relationship_filter defines the filter to be applied to the relationships
// to be counted.
RelationshipFilter relationship_filter = 2
[ (validate.rules).message.required = true ];
// name is the name of the counter whose count is being requested.
string name = 1[ (validate.rules).string = {

Check failure on line 148 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "1" with name "name" on message "ExperimentalCountRelationshipsRequest" changed option "json_name" from "consistency" to "name".

Check failure on line 148 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "1" on message "ExperimentalCountRelationshipsRequest" changed type from "message" to "string". See https://developers.google.com/protocol-buffers/docs/proto3#updating for wire compatibility rules and https://developers.google.com/protocol-buffers/docs/proto3#json for JSON compatibility rules.

Check failure on line 148 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "1" on message "ExperimentalCountRelationshipsRequest" changed name from "consistency" to "name".
pattern : "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$",
max_bytes : 64,
} ];
}

message ExperimentalCountRelationshipsResponse {
// read_at is the ZedToken at which the relationship count was performed
ZedToken read_at = 1 [ (validate.rules).message.required = true ];
oneof counter_result {
// counter_still_calculating is true if the counter is still calculating the count.
bool counter_still_calculating = 1;

uint64 relationship_count = 2;
// read_counter_value is the value of the counter at the time of the read.
ReadCounterValue read_counter_value = 2;
}
}

message ReadCounterValue {
// relationship_count is the count of relationships that match the filter.
uint64 relationship_count = 1;

// read_at is the ZedToken at which the relationship count applies.
ZedToken read_at = 2 [ (validate.rules).message.required = true ];
}

message ExperimentalUnregisterRelationshipCounterRequest {
RelationshipFilter relationship_filter = 1
[ (validate.rules).message.required = true ];
// name is the name of the counter being unregistered.
string name = 1[ (validate.rules).string = {
pattern : "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$",
max_bytes : 64,
} ];
}

message ExperimentalUnregisterRelationshipCounterResponse {}
Expand Down
Loading