Skip to content

Add ifChanged option to put method #1

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

Open
Rulexec opened this issue Feb 24, 2023 · 0 comments
Open

Add ifChanged option to put method #1

Rulexec opened this issue Feb 24, 2023 · 0 comments

Comments

@Rulexec
Copy link
Contributor

Rulexec commented Feb 24, 2023

Without ifNotPresent key-value record will be updated even if it has the same value. For example if you have {"key":"a", "value":"42", "generationId":"001"} stored in the database and next generationId is 002, if you'll /put {"key":"a", "value":"42"}, new record {"key":"a", "value":"42", "generationId":"002"} will be created.

We need to add ifChanged option to read previous stored value and update it only if it was changed.

This option should read value from current generation, not from the next one. Else if we have value A and two requests one of which wants to write A, second one wants to write B, B is faster, writes B, responds with wasPut: true, then first one checks that there is B, writes A back and responds with wasPut: true too. Later we'll add CAS that will check value in the next generation.

@Rulexec Rulexec changed the title add ifChanged option to put method Add ifChanged option to put method Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant