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

Optionally return status on WriteRelationships #106

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
34 changes: 33 additions & 1 deletion authzed/api/v1/permission_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,41 @@ message WriteRelationshipsRequest {
repeated Precondition optional_preconditions = 2
[ (validate.rules).repeated .items.message.required =
true ]; // To be bounded by configuration

// with_status, if true, indicates that the response should include the status of each update.
// This can be useful for knowing how to rollback a given call to WriteRelationships, but adds a small amount
// of compute overhead to the request.
bool with_status = 3;
}

message WriteRelationshipsResponse { ZedToken written_at = 1; }
// RelationshipUpdateStatus is the status of a relationship update.
message RelationshipUpdateStatus {
message Update {
// old is the previous relationship.
Relationship old = 1;
// new is the new relationship.
Relationship new = 2;
}

oneof status {
// no_op indicates that the relationship was not changed (already existed on TOUCH, or didn't exist on DELETE).
Relationship no_op = 1;
// created indicates that the relationship was created.
Relationship created = 2;
// deleted indicates that the relationship was deleted.
Relationship deleted = 3;
// updated indicates that the relationship was updated.
Update updated = 4;
}
}

message WriteRelationshipsResponse {
// written_at is the revision at which the relationships were written.
ZedToken written_at = 1;

// updates is the status of each relationship update, if requested.
repeated RelationshipUpdateStatus updates = 2;
}

// DeleteRelationshipsRequest specifies which Relationships should be deleted,
// requesting the delete of *ALL* relationships that match the specified
Expand Down
Loading