Feature request: conditions API#175
Closed
alsenz wants to merge 5 commits intothanos-io:mainfrom
Closed
Conversation
9e361e0 to
6362f65
Compare
…, inmem providers Signed-off-by: Tom Plowman <7210552+alsenz@users.noreply.github.com>
Signed-off-by: Tom Plowman <7210552+alsenz@users.noreply.github.com>
Signed-off-by: Tom Plowman <7210552+alsenz@users.noreply.github.com>
6362f65 to
7d699e8
Compare
Signed-off-by: Tom Plowman <7210552+alsenz@users.noreply.github.com>
…at_conditions_API_129
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.
Resolves #129
Adds support for conditional object uploads.
Extends
ObjectAttributeswith optionalObjectVersion(if supported), andUpload(...)with three newObjectUploadOption, depending on provider support.IfMatch: the object is written only if the existing object matches the provided versionIfNotMatch: the object is written only if the existing object does not match the provided versionIfNotExists: the object is written only if no object already exists for the provided keySupports two forms of
ObjectVersion:Not all providers support conditional write. The following providers are supported:
IfNotMatchis not yet supported (as it is not supported by AWS).Clients can check conditional API by calling
SupportedObjectUploadOptionson theBucketinterface.Changes
API changes
ObjectUploadOptions:IfMatch,IfNotMatchandIfNotExists1.1 Made
ObjectUploadOptiontyped, repeating the existingIterOptionpattern.1.2 Added three new parameter modifiers-
WithIfMatch,WithIfNotExistsandWithIfNotMatch, andWithContentTypeto support the previous un-typedObjectUploadOptionObjectVersionfield toObjectAttributesIfMatch,IfNotMatch,IfNotExistsand forAttributesAPIBucketprovider implementations for:1.1 filesystem: this now uses Extended Attributes, if supported by the host system
1.2 inmem
1.3 GCS
1.4 Azure
1.5 S3, excepting
IfNoneMatchwhich is not fully supported (by AWS) yet1.6 Wrappers
Backwards compatibility
API changes are additive and should be backwards compatible.
The
UploadAPI changes use a trailing variadic parameter so should be backwards compatibleThe
ObjectAttributesadd new field so should be backwards compatibleThe
SupportedObjectUploadOptionsinterface method potentially breaks existingBucketimplementations. Library users who implement their own providers will need to implement this method. Full or stub implementations are provided for all provider implementations in the libary.Dependencies
Verification
Added acceptance tests for
IfMatchIfNotMatchIfExistsDid not run integration tests on other object store providers, as I do not have access to test environments, but these should be unchanged.