using Chronos.Core.Model; using Chronos.Protocol; namespace Chronos.Data.Scheduling; /// /// What a host (the server, the desktop) tells its (owner review 2, R10): its time zone, the archive /// schedules work on, the system schedules standing for its timers, the clean-up steps its jobs run, and the actions it /// cannot run. Called from the scheduler's loop, off any UI thread; members must be thread-safe. /// public interface IScheduleHost { /// The zone of daily, weekly and monthly times: the PC's on the desktop, the container's (TZ) on the server. TimeZoneInfo TimeZone { get; } /// /// The archive schedules targeting current work on (the server's archive, the desktop's current one), with its /// settings as fresh as the host keeps them; null when there is none yet or it cannot be reached. The scheduler probes /// whether it is online itself. /// ValueTask GetArchiveAsync(CancellationToken cancellationToken); /// /// The system schedules: every timer that queues work on this host, as a visible schedule. Seeded at start by key and /// never overwritten (the user's edits stay); puts one back to these values. /// IReadOnlyList SystemSchedules { get; } /// The names of the clean-up steps this host's jobs run (normally those of ArchiveService.CleanupSteps). IReadOnlyList CleanupSteps { get; } /// /// Why this host does not run (a short code, e.g. not-here), or null when it may. Asked /// before the scheduler's own checks (), for the action list and at every run. /// string? Unavailable(string action); } /// /// A host's system schedule: identifies it across starts (archive-scan, /// index-backup, housekeeping…); the rest is what it is seeded with and reset to. is /// stored as given; clients show system schedules by their key in the user's language. /// public sealed record SystemSchedule( string SystemKey, string Name, string Action, ScheduleRecurrence Recurrence, ScheduleParametersDto? Parameters = null, bool Enabled = true, bool CatchUp = true, JobPriority Priority = JobPriority.Background);