Skip to content

Support for revisions in Find, AddOrUpdate #170

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

Merged
merged 6 commits into from
Oct 19, 2022

Conversation

dmlarionov
Copy link
Contributor

Revisions are essential feature for MVCC in CouchDB. Passing a revision to PUT request makes you aware of the conflict (if happen) via response 409 Conflict from CouchDB HTTP API. That's why we need to support passing revisions to AddOrUpdate method.

To avoid breaking changes with my addition and while more request options might be introduced in future, I contributed to DatabaseApiMethodOptions namespace and:

  • added FindOptions + ICouchDatabase<TSource>.FindAsync paired method
  • added AddOrUpdateOptions + ICouchDatabase<TSource>.AddOrUpdateAsync paired method
  • added AddOptions + ICouchDatabase<TSource>.AddAsync paired method

I suppose in the future another contributors whould't extend method parameters, instead add properties to DatabaseApiMethodOptions.*Options objects.

Unit-tests covering new options are added.

I checked and see that for attachements revisions are already supported by CouchAttachment class which is passing DocumentRev to DownloadAttachmentAsync(..) and DownloadAttachmentAsStreamAsync(..).

Added "Revisions" section to README.

@dmlarionov dmlarionov mentioned this pull request Jul 16, 2022
@matteobortolazzo
Copy link
Owner

Hey, @dmlarionov that's awesome! Sorry for the late review, it's hard to take care of everything! I'll merge into dev, review the other PRs/issues and then release

@matteobortolazzo matteobortolazzo changed the base branch from master to dev October 19, 2022 21:38
@matteobortolazzo matteobortolazzo merged commit 5d403f7 into matteobortolazzo:dev Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants