It's great that `WriteRelationships` happens in a ...
# spicedb
t
It's great that
WriteRelationships
happens in a transaction, but I've hit a few situations that one
WriteRelationships
call doesn't cover, requiring multiple spicedb calls and losing the transaction. For example, I'm trying to model a many-to-one relationship in SpiceDB, where it's invalid to have the same relationship to multiple entities (e.g. a document --> its parent directory). My options are thus: - Delete the old tuple and write the new tuple in one atomic
WriteRelationships
call, but this only works if I know the old tuple ahead of time, which I don't atm. - Make a
ReadRelationships
call, then do the first option. This works, but it runs the risk of a race condition. I could craft some custom locking mechanism for that. - Make a
DeleteRelationships
call, then make a
WriteRelationships
call. If the second call fails, I've left the system in a corrupted state. A transaction would've been great here.
2 Views