Skip to main content

tandem_server/runtime/
lease.rs

1#[derive(Debug, Clone)]
2pub struct EngineLease {
3    pub lease_id: String,
4    pub client_id: String,
5    pub client_type: String,
6    pub acquired_at_ms: u64,
7    pub last_renewed_at_ms: u64,
8    pub ttl_ms: u64,
9}
10
11impl EngineLease {
12    pub fn is_expired(&self, now_ms: u64) -> bool {
13        now_ms.saturating_sub(self.last_renewed_at_ms) > self.ttl_ms
14    }
15}