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

add readBulkRelationships-API #128

Closed
Closed
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
54 changes: 54 additions & 0 deletions authzed/api/v1/permission_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ service PermissionsService {
};
}

rpc ReadBulkRelationships(ReadBulkRelationshipsRequest)
returns (ReadBulkRelationshipsResponse) {
option (google.api.http) = {
post: "/v1/relationships/readbulk"
body: "*"
};
}

// WriteRelationships atomically writes and/or deletes a set of specified
// relationships. An optional set of preconditions can be provided that must
// be satisfied for the operation to commit.
Expand Down Expand Up @@ -262,6 +270,52 @@ message ReadRelationshipsResponse {
Cursor after_result_cursor = 3;
}

// ReadBulkRelationshipsRequest specifies one or more filters used to read matching
// relationships within the system in a non-streaming fashion.
message ReadBulkRelationshipsRequest {
Consistency consistency = 1;

repeated ReadBulkRelationshipsRequestItem items = 2 [ (validate.rules).repeated .items.message.required = true ];

// optional_cursor, if specified, indicates the cursor after which results should resume being returned.
// The cursor can be found on the ReadBulkRelationshipsResponse object.
Cursor optional_cursor = 3;
}

message ReadBulkRelationshipsRequestItem {
// relationship_filter defines the filter to be applied to the relationships
// to be returned.
RelationshipFilter relationship_filter = 1 [ (validate.rules).message.required = true ];

// optional_limit, if non-zero, specifies the limit on the number of relationships to return.
// By default, all matching relationships will be returned.
uint32 optional_limit = 2 [(validate.rules).uint32 = {gte:0}];

}

message ReadBulkRelationshipsResponse {
// read_at is the ZedToken at which the relationships were found.
ZedToken read_at = 1 [ (validate.rules).message.required = false ];

repeated ReadBulkRelationshipsPair pairs = 2 [ (validate.rules).repeated .items.message.required = true ];

// after_result_cursor holds a cursor that can be used to resume reading after all results in this response.
// This replaces the per-item cursors to provide consistency across the entire bulk read operation.
Cursor after_result_cursor = 3;
}

message ReadBulkRelationshipsPair {
ReadBulkRelationshipsRequestItem request = 1;
oneof response {
ReadBulkRelationshipsResponseItem item = 2;
google.rpc.Status error = 3;
}
}

message ReadBulkRelationshipsResponseItem {
Relationship relationships = 1;
}

// Precondition specifies how and the existence or absence of certain
// relationships as expressed through the accompanying filter should affect
// whether or not the operation proceeds.
Expand Down
Loading