Commit ac418b5
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
File tree
19 files changed
+1972
-1818
lines changed- hugr-persistent
- src
- commit
- persistent_hugr
- snapshots
- state_space
- snapshots
- tests
19 files changed
+1972
-1818
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
0 commit comments