SlotOutcome
What FairSharePool.acquire answered: a slot, or the reason none can be granted to that leaf as the tree stands now.
Samples
val farm = Topology("farm", listOf(Topology.Lane("web", Weight.of(3)), Topology.Lane("mobile")))
val web = farm.groupId("web")
val mobile = farm.groupId("mobile")
val (heddle, booted) = LocalHeddle.fromTopology(farm, LocalPolicy(defaultReservation = 3L), epoch = 0L)
check(booted.refusals.isEmpty())
// Two agents, and one unit of cost is one minute on an agent. The pool owns the engine now.
val pool = FairSharePool(heddle, slots = 2, TimeSource.Monotonic, costUnit = 1.minutes)
// Waits until fair share grants web a slot: at once, on an idle farm.
val build = pool.acquire(web)
check(build is SlotOutcome.Granted)
// The build took five minutes against the default estimate of three: two are overrun.
check(pool.complete(build.lease.id, actualCost = 5L) == LeaseOutcome.Done(charged = 5L, overrun = 2L, unrecorded = 0L))
// A name the farm does not declare is refused, never left waiting.
check(pool.acquire(GroupId("nightly")) is SlotOutcome.Refused)
val next = pool.acquire(mobile)
check(next is SlotOutcome.Granted)
pool.cancel(next.lease.id)Content copied to clipboard
Inheritors
Types
Link copied to clipboard
The caller holds lease, one of the pool's slots, and must FairSharePool.complete or FairSharePool.cancel it.
Link copied to clipboard
No lease can be granted to the leaf: reason is the engine's own explanation, WaitExplanation.NoLiveLineage for a name no lease can end at, or WaitExplanation.LifetimeExhausted for a lane whose lifetime counter is full.