chronon_core/models/partition_assignment.rs
1//! Partition ownership for distributed coordinators.
2
3use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6/// Per-partition lease for coordinator shard ownership.
7///
8/// Each scheduler instance owns a subset of partitions; the assigner upserts rows so tick
9/// discovery only scans jobs hashed into owned partitions.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct PartitionAssignment {
12 /// Partition index as a string key (matches hash ring slot).
13 pub partition_id: String,
14 /// Scheduler instance id currently responsible for this partition.
15 pub owner_instance_id: String,
16 /// Assignment expiry; partitions may be stolen after this instant.
17 pub lease_until: DateTime<Utc>,
18 /// Last time this row was written (rebalance or heartbeat).
19 pub updated_at: DateTime<Utc>,
20}