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 #1906

Closed

Conversation

benvernier-sc
Copy link

This PR is part of a proof of concept for #1903.

It temporarily uses a replace statement in go.mod to use the files generated in https://github.com/benvernier-sc/authzed-go/tree/write_relationships_status from authzed/api#106.

It defines a new core protobuf message RelationTupleUpdateStatus that corresponds to the RelationshipUpdateStatus from the API protobuf.

It then updates the signature of ReadWriteTransaction.WriteRelationships from

type ReadWriteTransaction interface {
    // [...]
    WriteRelationships(ctx context.Context, mutations []*core.RelationTupleUpdate) error
    // [...]
}

to

type ReadWriteTransaction interface {
    // [...]
    WriteRelationships(ctx context.Context, mutations []*core.RelationTupleUpdate, returnStatus bool) ([]*core.RelationTupleUpdateStatus, error)
    // [...]
}

This allows to specify whether the store should return the status of the operations or not, and adds a return field with said statuses that are only guaranteed to be populated if returnStatus was true.

All the usages of WriteRelationships store method were updated to ensure the code would still compile. The WriteRelationships gRPC handler was updated to actually pass the WithStatus option from the request and use the returned statuses.

So far only the Postgres implementation has been updated to honor the new options. All scenarios have been tested locally, but no automated tests have been written so far.

@github-actions github-actions bot added area/api v1 Affects the v1 API area/datastore Affects the storage system area/dependencies Affects dependencies area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels May 21, 2024
Copy link

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2024
@josephschorr
Copy link
Member

@benvernier-sc Decided this approach didn't work?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/api v1 Affects the v1 API area/datastore Affects the storage system area/dependencies Affects dependencies area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants