Skip to content

Optionally return operation statuses on WriteRelationships #1903

Open
@benvernier-sc

Description

@benvernier-sc

Problem Statement

The SpiceDB docs cover a Two writes & commits scenario to do dual writes between an existing system and SpiceDB. Those docs suggest performing a WriteRelationships call as part of the primary write path for the data, then performing a DeleteRelationships request if a rollback if necessary.

The issue is that if I had a relationship that already existed, I performed a WriteRelationships request with a TOUCH operation on that existing relationship (which would have been a no-op internally) then want to rollback my operation, calling DeleteRelationships would actually leave my system in a different state than what it was in before I started the operation.

Similarly, if one of the operations of my WriteRelationships request was a DELETE operation but the relationship didn't actually exist in SpiceDB, I do not want to create the relationship on rollback as once again this would leave the system in a different state.

Solution Brainstorm

When making a call to WriteRelationships (with either a single or multiple updates), there are cases where it would be useful to be able to get what the status of each operation was in the response.

In particular, knowing whether a TOUCH operation actually created a relationship or if it was a no-op, and knowing whether a DELETE operation actually deleted a relationship or if it was a no-op.

I acknowledge that systematically returning that information might come at a performance cost that existing use cases that don't need this information might not be comfortable with, so this could be an option set on the request to specify whether the status breakdown should be returned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions