public Phase(MultiHash previousDeltaDfsHash, IPhaseName phaseName, IPhaseStatus phaseStatus, DateTime utcStartTime) { PreviousDeltaDfsHash = previousDeltaDfsHash; Name = phaseName; UtcStartTime = utcStartTime; Status = phaseStatus; }
/// <summary> /// Use this to get a stream of state change events occuring at the time configured by <see cref="timings"/> every <see cref="cycleDuration"/> /// </summary> /// <param name="name">The name of the phase for which you need the state change events.</param> /// <param name="timings">The timing configuration for the phase.</param> /// <param name="cycleDuration">The total duration of a delta production cycle.</param> /// <param name="scheduler">The IScheduler used to synchronise the Timers.</param> /// <returns></returns> public static IObservable <StatefulPhase> GetStatusChangeObservable(IPhaseName name, IPhaseTimings timings, TimeSpan cycleDuration, IScheduler scheduler) { var phaseInProducingStatus = Observable .Timer(timings.Offset, cycleDuration, scheduler) .Select(_ => new StatefulPhase(name, PhaseStatus.Producing)); var phaseInCollectingStatus = Observable .Timer(timings.Offset + timings.ProductionTime, cycleDuration, scheduler) .Select(_ => new StatefulPhase(name, PhaseStatus.Collecting)); var phaseInIdleStatus = Observable .Timer(timings.Offset + timings.TotalTime, cycleDuration, scheduler) .Select(_ => new StatefulPhase(name, PhaseStatus.Idle)); return(phaseInProducingStatus.Merge(phaseInCollectingStatus, scheduler).Merge(phaseInIdleStatus, scheduler)); }
public StatefulPhase(IPhaseName name, IPhaseStatus status) { Name = name; Status = status; }