SaveEffect
What a TopologyChange costs in fairness history; see TopologyChange.saveEffect. Three answers, because an editor does three things: saves, warns, or refuses.
Its sibling for one edit of a document is TopologyEdit.History, which has six answers.
Samples
val running = draft("pool") {
group("acme", Weight.of(3)) {
lane("interactive")
lane("batch")
}
group("tenants") { template(Weight.of(2)) }
}
val edited = draft("pool") {
group("acme", Weight.of(3)) {
lane("interactive", maxConcurrent = 2)
lane("nightly")
}
// A new template ceiling keeps the attached children's history; a new weight would not.
group("tenants") { template(Weight.of(2), maxConcurrent = 4) }
}
val changes = running.changesTo(edited)
check(changes.none { it.saveEffect == TopologyChange.SaveEffect.NEW_TREE })
// Of four changes, only the removal of batch costs anyone their history.
val warnings = changes.filter { it.saveEffect == TopologyChange.SaveEffect.LOST }
check(changes.size == 4 && warnings.map { it.names } == listOf(listOf("pool", "acme", "batch")))
// A renamed root is a new tree, which apply throws on, so the save is refused, not warned about.
val renamed = draft("farm") { lane("batch") }
check(running.changesTo(renamed).first().saveEffect == TopologyChange.SaveEffect.NEW_TREE)Entries
A group loses its history. A Removed child drains and retires with everything beneath it; a WeightChanged child restarts its share at its parent's front; a TemplateRemoved closes every child the app attached under that group, for good; and a TemplateChanged with a new weight at any level restarts the shares at that level, or with a nested template gone closes the children attached under it.
A RootRenamed: a new tree, not an edit of the running one. LocalHeddle.apply and Topology.diff throw IllegalArgumentException for it, so an editor refuses the save rather than warning about it.
Companion properties
Returns an immutable kotlin.enums.EnumEntries list containing the constants of this enum type, in the order they're declared.
Companion functions
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
Returns an array containing the constants of this enum type, in the order they're declared.