Add new WriteAsync condition and ETag response result - #714
Draft
sw-joelmut wants to merge 1 commit into
Draft
Conversation
Member
|
I think short of a v2, we should just have an extended interface for IStorage. As Matt suggested extend the existing with the new operations. There is possibly another operation about getting a paginated list of records, assuming we can abstract that across providers. |
Collaborator
Author
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.

Description
This PR extends the functionality of the WriteAsync methods in Blobs, Cosmos, and Memory storages by allowing users to pass new options that currently contain the ifNotExists condition, and to return the created/updated ETag as a result of the operation.
The purpose of these changes is to introduce these improvements without modifying the existing signature of the IStorage interface.
There are multiple approaches to accomplish this, but the least hacky way was to add the new WriteAsync overload method to each Storage without impacting the interface or creating a second IStorageExt with new signatures.

Here are two of the most relevant alternatives (POC) to the current changes in the PR, without adding more WriteAsync overloads:
AsyncLocal + Disposable options
StoreItem wrapper
Other less fisable alternatives
Testing
Once the PR is no longer in draft, we will include tests of Agent samples working with the storages.