Skip to content

KV store: Implement transaction rollback#241

Open
nrc wants to merge 2 commits into
mainfrom
nrc/kv-txn-rollback
Open

KV store: Implement transaction rollback#241
nrc wants to merge 2 commits into
mainfrom
nrc/kv-txn-rollback

Conversation

@nrc

@nrc nrc commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This means that transactions are atomic, even if a transaction is abandoned.

Closes #216

To review, I would start with the new docs in lib.rs, then read storage.rs (where most of the changes are). The rest should be fairly straightforward after that.

This does end up making the API a bit more restrictive, that is because to enable transaction rollback, we need to be able to clone values, and we can no longer move out of the store, so remove and insert can't return the removed old values. (technically we could with the raw API, but because code is shared, that is not possible. If we want to implement that for performance or ergonomics, we can). Work-around is to use get and clone.

LLM declaration. I used Claude to generate tests and have reviewed the generated code.

@nrc nrc force-pushed the nrc/kv-txn-rollback branch 3 times, most recently from 4eb2c2f to b1e2b2b Compare June 16, 2026 09:42
This means that transactions are atomic, even if a transaction is abandoned.

Signed-off-by: Nick Cameron <nrc@ncameron.org>
@nrc nrc force-pushed the nrc/kv-txn-rollback branch from b1e2b2b to 94d1468 Compare June 17, 2026 01:17
Comment thread ts_kv_store/src/storage.rs
Comment thread ts_kv_store/src/lib.rs Outdated
Comment thread ts_kv_store/src/storage.rs Outdated
Comment thread ts_kv_store/src/storage.rs Outdated
Comment thread ts_kv_store/src/storage.rs
Comment thread ts_kv_store/src/transactions.rs
Comment thread ts_kv_store/src/schema.rs Outdated
Comment thread ts_kv_store/src/storage.rs Outdated
Signed-off-by: Nick Cameron <nrc@ncameron.org>
@nrc nrc requested a review from npry June 17, 2026 22:40
@nrc

nrc commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@npry thanks for the review! All comments addressed in the separate commit (and/or replies)

@npry npry left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

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.

KV store: transaction rollback

2 participants