Propagate resource revision to/from the backend#32040
Merged
rosstimothy merged 3 commits intomasterfrom Sep 26, 2023
Merged
Conversation
8ce976c to
b0a65c4
Compare
Adds a new `MarshalOption` that ensures the resource revision is set when unmarshalling a backend item. The new `WithRevision` option was also applied everywhere that the legacy `WithResourceID` was being used.
The revision follows the same semantics as the resource id for marshalling. This prevents both items from showing up in the value of the backend item, which can prevent compare and swap operations from completing succesfully. Each backend is responsible for persisting the revision in some manner. The existing PreserveResourceID was reused to prevent having to make multiple copies of a resource when clearing the id and revision. The marshal option will be updated in a follow up when the resource id is removed.
af2a562 to
ea51c8b
Compare
ea51c8b to
542ea2c
Compare
Contributor
Author
|
PTAL reviewers |
justinas
approved these changes
Sep 25, 2023
fspmarshall
approved these changes
Sep 26, 2023
rosstimothy
added a commit
that referenced
this pull request
Oct 10, 2023
* Set revision on resources retrieved from the backend Adds a new `MarshalOption` that ensures the resource revision is set when unmarshalling a backend item. The new `WithRevision` option was also applied everywhere that the legacy `WithResourceID` was being used. * Prevent storing resource revision in the backend item value The revision follows the same semantics as the resource id for marshalling. This prevents both items from showing up in the value of the backend item, which can prevent compare and swap operations from completing succesfully. Each backend is responsible for persisting the revision in some manner. The existing PreserveResourceID was reused to prevent having to make multiple copies of a resource when clearing the id and revision. The marshal option will be updated in a follow up when the resource id is removed. * Ignore revision in resource comparisons
rosstimothy
added a commit
that referenced
this pull request
Oct 17, 2023
* Set revision on resources retrieved from the backend Adds a new `MarshalOption` that ensures the resource revision is set when unmarshalling a backend item. The new `WithRevision` option was also applied everywhere that the legacy `WithResourceID` was being used. * Prevent storing resource revision in the backend item value The revision follows the same semantics as the resource id for marshalling. This prevents both items from showing up in the value of the backend item, which can prevent compare and swap operations from completing succesfully. Each backend is responsible for persisting the revision in some manner. The existing PreserveResourceID was reused to prevent having to make multiple copies of a resource when clearing the id and revision. The marshal option will be updated in a follow up when the resource id is removed. * Prevent backend items with empty revisions All resource revisions are now being set on a backend.Item before persisting the item to the backend. * Ignore revision in resource comparisons
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Oct 17, 2023
* Set revision on resources retrieved from the backend Adds a new `MarshalOption` that ensures the resource revision is set when unmarshalling a backend item. The new `WithRevision` option was also applied everywhere that the legacy `WithResourceID` was being used. * Prevent storing resource revision in the backend item value The revision follows the same semantics as the resource id for marshalling. This prevents both items from showing up in the value of the backend item, which can prevent compare and swap operations from completing succesfully. Each backend is responsible for persisting the revision in some manner. The existing PreserveResourceID was reused to prevent having to make multiple copies of a resource when clearing the id and revision. The marshal option will be updated in a follow up when the resource id is removed. * Prevent backend items with empty revisions All resource revisions are now being set on a backend.Item before persisting the item to the backend. * Ignore revision in resource comparisons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ensures that the revision is set on all backend items and that the revision is properly unmarshalled from a backend item when retrieving items from the backend.
Contributes to #30416.
Depends on https://github.com/gravitational/teleport.e/pull/2235 and https://github.com/gravitational/teleport.e/pull/2269