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

chore: contextual tuples use WriteRequestTupleKey #101

Closed

Conversation

rhamzeh
Copy link
Member

@rhamzeh rhamzeh commented Oct 2, 2023

Description

Considering that Contextual Tuples act like tuples that have been written, it makes sense that they use WriteRequestTupleKey.

Opening up the PR for conversations and thoughts

References

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@rhamzeh rhamzeh requested a review from a team as a code owner October 2, 2023 02:15
@rhamzeh rhamzeh requested a review from jpadilla October 2, 2023 02:15
@jon-whit
Copy link
Contributor

jon-whit commented Oct 3, 2023

Contextual tuples just augment the tuples in the database. They only differ in that they are provided at request-time. When we handle a contextual tuple key we pass it straight through and yield it as though it was any other TupleKey from the database. Consequently, if we change this to a WriteRequestTupleKey then we'll have to translate each and every contextual tuple to/from a TupleKey in critical code paths dealing with the TupleKey logic (e.g. core Check and ListObjects paths). For that reason, it makes sense to me to have them represented as a TupleKey (e.g. the same thing the storage layer is returning). This avoids conversions in critical code paths and overloading the struct in various places it is used.

@jpadilla jpadilla added the abac label Oct 9, 2023
@rhamzeh rhamzeh closed this Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants