linksplatform / linksplatform/doublets-rs
No transactions layer: C# has UInt64LinksTransactionsLayer, Rust has nothing
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6
- Forks
- 0
- Avg merge
- 1h 37m
- Merged PRs (30d)
- 1
Description
## Summary
`doublets` has no transactions layer. C# has shipped one in `Platform.Data.Doublets` for years (`UInt64LinksTransactionsLayer`, `ITransaction`, `Transition`), so a consumer that wants "apply these writes or none of them" has to write the layer itself in Rust.
```console
$ grep -rli transaction doublets-0.5.0/src
$ # no matches
```
## What is missing
The pieces C# has and Rust does not:
- a transaction handle with `Commit`/`Rollback`, rolling back on drop when neither was called;
- a transition record — `(before, after)` doublets plus a kind — appended per write;
- a durable transition log, so an interrupted process can be recovered rather than left half-written;
- replay/revert of a transition, which is what both rollback and recovery are built from.
Every one of these is generic over the store, which is exactly the kind of thing [`decorators`](https://docs.rs/doublets/0.5.0/doublets/decorators/index.html) is already the home for: a `TransactionsDecorator` would compose the same way `UniquenessResolver` does.
## Evidence
[link-foundation/link-cli](https://github.com/link-foundation/link-cli) needed this in both languages and had to write the Rust half from scratch:
- [`rust/src/transactions/`](https://github.com/link-foundation/link-cli/tree/3d53362125be47de595b0cad7a24fe4c3aeefd3d/rust/src/transactions) — ~1570 lines: the decorator, the transition types, and a file-backed transition log with retention policies
`WriteHandler` already gives a decorator the `(before, after)` pair a transition needs, so the store-facing half of the work is done — what is missing is the layer that collects them, makes them durable, and can play them backwards.
## Related, if this is taken on
Two layers built on top of the same transition stream, also written by hand in the same repo, would become straightforward for any consumer once transactions exist upstream:
- [`version_control/`](https://github.com/link-foundation/link-cli/tree/3d53362125be47de595b0cad7a24fe4c3aeefd3d/rust/src/version_control) — branches, tags and checkout over the transition sequence (~670 lines)
- [`persistent_transformations.rs`](https://github.com/link-foundation/link-cli/blob/3d53362125be47de595b0cad7a24fe4c3aeefd3d/rust/src/persistent_transformations.rs) — triggers re-applied after every write (~670 lines)
Neither exists in C# either, so they are a weaker upstream claim than transactions themselves — mentioning them only because they are what a transition log unlocks.
Reported from link-foundation/link-cli#100, which asks that gaps found while updating to doublets 0.5.0 be filed here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing decorators and WriteHandler, then compare them with link-cli's rust/src/transactions/ implementation. The work is complete when a generic TransactionsDecorator provides commit/rollback handles, records transitions, persists a recoverable log, and supports replay and revert.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100