chronon_core/models/scheduler_leader.rs
1//! Scheduler leader election singleton row.
2
3use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6/// Singleton row for distributed scheduler leader election.
7///
8/// Only the leader instance runs the coordinator tick loop in split deployments. Other
9/// instances renew partition assignments and execute runs as workers.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct SchedulerLeader {
12 /// Fixed row id (typically `"singleton"`).
13 pub leader_id: String,
14 /// Instance id of the current leader.
15 pub leader_instance_id: String,
16 /// Leader lease expiry; followers may campaign after this instant.
17 pub leader_lease_until: DateTime<Utc>,
18 /// Last successful leader heartbeat (diagnostics and staleness checks).
19 pub last_heartbeat_at: DateTime<Utc>,
20}