Expand description
Cheap, send-able rope snapshots tagged with a revision.
RopeSnapshot is the only buffer-shaped value that crosses thread
boundaries: decoration workers, the persistence thread, and the search
indexer all consume snapshots produced on the editor core thread.
Every constructed snapshot registers a Weak<Rope> with the
process-wide RopeSnapshotRegistry and deregisters on drop. The
registry surfaces “how many live snapshots exist” and “how many
distinct Arc<Rope> heads do they pin” — the two numbers Block 1.2
of the memory optimization plan uses to detect divergent-rope
generations held by long-lived workers.
Limitation. We compare Arc<Rope> pointer identity, not the
inner Arc<Node> head ropey uses for structural sharing. Two
RopeSnapshots built from independent Arc::new(rope.clone())
calls count as two distinct generations even when the underlying
ropey state is byte-identical. The metric therefore tracks
“distinct snapshot rope handles” rather than the structurally-true
“distinct rope generations”; a single distinct handle is still the
healthy steady state we want to gate on.
Structs§
- Rope
Snapshot - An immutable, ref-counted view of a buffer’s contents at a specific revision.
- Rope
Snapshot Registry - Process-wide registry of live
RopeSnapshots. Entries are weak references; drops deregister explicitly so the map does not bloat with stale weaks during steady state.