Nested
An attached child name of the attached group at parent: a child the consumer attached beneath another attached child, whose template carries a template of its own.
parent is always an Attached or another Nested, never a Declared: a child of a declared group is an Attached, so that every attached child has exactly one path. Everything below an attached child is attached; a declared name never follows an attached one.
Throws
Samples
val ci = draft("ci") {
// Each repository weighs 2 beside the nightly lane, and each author caps at one job.
group("repos") { template(Weight.of(2), template = Topology.ChildTemplate(Weight.ONE, maxConcurrent = 1L)) }
lane("nightly")
}
val (heddle, booted) = LocalHeddle.fromTopology(ci, LocalPolicy(defaultReservation = 1L), epoch = 0L)
check(booted.refusals.isEmpty())
heddle.reconcileCapacity(totalSlots = 4L)
// Attaching an author attaches its repository too, in the same unit.
val kuilt = GroupPath.Attached(listOf("repos"), "kuilt")
val alice = GroupPath.Nested(kuilt, "alice")
check(heddle.attach(alice, generation = 1L).refusals.isEmpty())
val aliceId = checkNotNull(ci.findGroupId(alice))
check(aliceId == GroupId("ci/repos/!kuilt/!alice") && ci.findPath(aliceId) == alice)
// Work is charged to the author; the repository itself is never leased.
val kuiltId = checkNotNull(ci.findGroupId(kuilt))
check(heddle.admit(kuiltId, waiting = setOf(kuiltId), startedAt = 0L) == AcquireOutcome.NoLiveLineage(kuiltId))
val lease = (heddle.acquire(setOf(aliceId), setOf(aliceId), startedAt = 0L) as AcquireOutcome.Acquired).lease
check(lease.leaf == aliceId)
// Detaching the repository closes alice too, and waits for her running job.
val detached = heddle.detach(kuilt)
check(detached.refusals.isNotEmpty() && detached.refusals.all { it is StepRefusal.Draining })
check(heddle.complete(lease.id, actualCost = 1L, waiting = emptySet()) is LeaseOutcome.Done)
check(heddle.detach(kuilt).refusals.isEmpty())Content copied to clipboard