authzed-java/examples/v1/App.java at mai...
# spicedb
z
@vroldanbet Hi when I use java sdk to check permission, the function needs a parameter called
zedToken
. How can I get the
zedToken
without updating relationships? Whether there has a single interface to get
zedToken
? https://github.com/authzed/authzed-java/blob/main/examples/v1/App.java I also felt confused why not other language sdk need
zedToken
? https://authzed.com/docs/spicedb/getting-started/protecting-a-blog
v
you don't need a zedtoken, but it's recommended. SpiceDB has a tunable consistency model, please read https://authzed.com/docs/spicedb/concepts/consistency
to your question, you can get a zedtoken from pretty much every API call. You can do
ReadSchema
and it will give you the zedtoken at which the schema was evaluated, same for
CheckPermissions
with
minimize_latency
consistency
z
"every API call" means I need a distributed lock to store latest zedtoken?
I also have a question about how to ensure updating many relationships is atomic within the same transaction.
v
you only need to store the zedtoken if: - you care about the new enemy problem - when you need "read-your-writes" consistency - when you want to get the best performance out of SpiceDB
you store zedtokens when write to spicedb. This write usually reflects a change originating from source resource in your business domain. The recommendation is to store the zedtoken alongside your database row representing your resource
>I also have a question about how to ensure updating many relationships is atomic within the same transaction You use the
WriteRelationships
API. It's atomic.
z
Thank you so much
21 Views