public sealed class MapFleetOne map's shards over time, and the hysteresis that keeps the count sane.
Remarks
The stateful half of doc 27 § Placement, and it is stateful for exactly two reasons: a spawn is debounced against the last one, and a merge has to have been true for a while. Everything else it decides is a function of the shards it is shown.
⚠ One action per observation, and a spawn beats a drain. A fleet that returned both would be asked to grow and shrink in the same breath; and a map that is saturating while one of its shards is nearly empty wants the shard, not the tidiness.
⚠ The clock is a parameter. Every method takes now, so a test can run a flash crowd, a slow bleed and a sawtooth through half an hour of simulated traffic in milliseconds — which is what doc 27 § Testing asks of this.
Fields and properties (3)
public ShardKey KeyWhat this fleet is for.
public FleetPolicy PolicyThe thresholds in force.
public int ArrivalsInWindowHow many arrivals are inside the window, as of the last call.
Methods (4)
public MapFleet(ShardKey key, FleetPolicy? policy = null)Stands one up.
public void Arrived(DateTimeOffset now, int count = 1)Records people arriving, which is what the spawn projection is made of.
public double ArrivalRate(DateTimeOffset now)Arrivals per second, over the span they landed in.
public FleetAction Observe(DateTimeOffset now, IReadOnlyList<ShardCandidate> shards)Decides what to do about the map, given what it currently is.
Used by (3)
- FleetSimulationVixen.Live.Orchestrator.Tests
- MapCoordinatorVixen.Live.Orchestrator
- MapFleetTestsVixen.Live.Orchestrator.Tests