topology
The tree this engine runs: the one fromTopology booted, or the one apply was last given, or after a restore, the one the persisted engine ran. It is always equal to the LocalHeddleSnapshot.lastApplied that persist writes. attach and detach leave it as it is: an attached child is the ledger's, and the tree holds only its group's template.
It is the tree last asked for, not a picture of the ledger. A group a boot or a reload left out is in it as written, and a lane a reload removed is not, though its leases may still drain: ApplyResult says what landed, and Topology.diff what is left between this tree and the ledger.
An admin page editing the tree reads it when the edit starts, and writes it out with Topology.toDocument for the editor. Before applying, startedFrom.changesTo(candidate) (Topology.changesTo) lists what the edit changes, and the checked apply, given startedFrom, applies only if nobody else applied a tree in between: it compares startedFrom with this property. revision cannot tell that: every acquire moves it.
Never absent, since every engine a caller can build has a tree. Reading it changes nothing and does not move revision. Read it under the caller's scheduling lock, like the rest of the engine. A Topology is immutable, so the value can be used off the lock.
Samples
val (heddle, _) = LocalHeddle.fromTopology(twoLanes(), LocalPolicy(defaultReservation = 3L), epoch = 0L)
// The page opens its editor on the running tree, written out as a document, and adds a lane.
val startedFrom = heddle.topology
val document = startedFrom.toDocument()
val edited = (Topology.from(document.copy(children = document.children + TopologyDocument.Lane("batch"))) as TopologyParse.Valid).topology
// The admin confirms what the edit changes, and it becomes the running tree.
check(startedFrom.changesTo(edited) == listOf(TopologyChange.Added(listOf(2), listOf("pool", "batch"), Topology.Lane("batch"))))
check(heddle.apply(edited, generation = 1L, startedFrom = startedFrom) is ApplyOutcome.Applied)
check(heddle.topology == edited && heddle.persist().lastApplied == edited)