Skip to content
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

Can batch be used to implement transactions? #29

Closed
hannesm opened this issue Jun 13, 2022 · 0 comments · Fixed by ocaml/opam-repository#22648
Closed

Can batch be used to implement transactions? #29

hannesm opened this issue Jun 13, 2022 · 0 comments · Fixed by ocaml/opam-repository#22648

Comments

@hannesm
Copy link
Member

hannesm commented Jun 13, 2022

Can I use the batch operation in application code for doing a series of sets and deletes (potentially leading to an error), and the result will be that either all sets and deletes are done, and the result is positive, or the result is an error and nothing has been done.

I suspect the answer is no, should we have two operations, start_transaction and commit_transaction, where the first would produce a token (to be used as a KV.t), and the second apply a transaction? We can as well have a cancel_transaction... Somehow that'd be a desired semantics for lots of applications. Certainly that'd be more difficult to implement in some backends, so maybe that could also be a separate interface (KV_RW_atomic)? //cc @samoht

@hannesm hannesm closed this as completed in 7930226 Dec 3, 2022
hannesm added a commit to hannesm/opam-repository that referenced this issue Dec 12, 2022
CHANGES:

* Use ptime directly for RO.last_modified, instead of the int * int64 pair
  (mirage/mirage-kv#34)
* Add RW.allocate to allocate a key and fill it with zero bytes (mirage/mirage-kv#34)
* RO.list: return Key.t instead of string (mirage/mirage-kv#37, fixes mirage/mirage-kv#33)
* Introduce a custom error for RW.rename with a source which is a prefix of
  destination (mirage/mirage-kv#37, fixes mirage/mirage-kv#31)
* Use Optint.Int63.t for RO.size, RO.get_partial, RO.set_partial (mirage/mirage-kv#37, fixes mirage/mirage-kv#32)
* Remove RW.batch (mirage/mirage-kv#37, fixes mirage/mirage-kv#29 mirage/mirage-kv#36, discussed at the MirageOS meeting in
  November, and on the mirageos-devel mailing list in January 2022)
* Key.pp: escape the entire string, not individual fragments (mirage/mirage-kv#35)
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 a pull request may close this issue.

1 participant