hypertrace/document-store

[Feature Request] support for conditional insert and update

Closed this issue · 0 comments

Use Case,

The document store's collection API provides an update interface that inserts and updates the docuemnt.
There are cases where we would like to insert and update the document if the condition match.
e.g

  • Update the document only if the last updated time was lesser than the current time
  • Update the document only if the version value is less than the new version value

The above conditional-based update interface will be helpful in client-side optimistic locking for concurrent updates.

Proposal

We will have a newer interface that will take Filter as part of the interface which will be added into where clause of an update
e.g
<Document/boolean> upsert(Key key, Document document, Filter condition) throws IOException;

Questions to address (if any)

  • explore if the concurrent insert will aslo be taken care of.