Skip to content

Commit ac418b5

Browse files
authored
feat(persistent): Redesign CommitStateSpace, bound Commit lifetime (#2534)
This PR updates the relrc dependency to v0.5.0 and completely redesigns the `CommitStateSpace` struct. The result is much cleaner: - `PersistentHugr` is an immutable data type following the design of the types of the [`im` crate](https://docs.rs/im/latest/im/), i.e. it is a mutable Rust type that is cheap to clone and mutate (immutability -- if desired -- is achieved by cloning before mutating). - `Commit` is a "transaction", i.e. one atomic mutation that was applied to a `PersistentHugr`. It has an ID, obtainable through `commit.id()` and a lifetime parameter that ensures it does not stay in scope beyond the lifetime of the `PersistentHugr` - Each `PersistentHugr` belongs to a unique `CommitStateSpace`. A `CommitStateSpace` is a registry of all commits of the `PersistentHugr`s within that state space. It keeps the map between commits and IDs. This is a breaking change, but does not trigger a breaking HUGR release because it is hidden behind an unstable feature.
1 parent 1cd08ef commit ac418b5

19 files changed

+1972
-1818
lines changed

Cargo.lock

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pest_derive = "2.8.2"
8989
pretty = "0.12.5"
9090
pretty_assertions = "1.4.1"
9191
zstd = "0.13.2"
92-
relrc = "0.4.6"
92+
relrc = "0.5.0"
9393
wyhash = "0.6.0"
9494

9595
# These public dependencies usually require breaking changes downstream, so we

hugr-persistent/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ bench = false
3939
rstest.workspace = true
4040
semver.workspace = true
4141
serde_with.workspace = true
42-
insta.workspace = true
42+
insta = { workspace = true, features = ["yaml"] }

0 commit comments

Comments
 (0)