pub struct RuntimeLeaseCoordinator { /* private fields */ }Expand description
One-controller, many-observer coordination state for a live runtime.
Implementations§
Source§impl RuntimeLeaseCoordinator
impl RuntimeLeaseCoordinator
Sourcepub fn new(lease_ttl_ms: u64) -> RuntimeLeaseCoordinator
pub fn new(lease_ttl_ms: u64) -> RuntimeLeaseCoordinator
Create a coordinator with a non-zero controller lease duration.
Sourcepub fn attach(
&mut self,
client_id: RuntimeClientId,
authorization: &RuntimeAuthorization,
now_ms: u64,
) -> Result<RuntimeLeaseSnapshot, RuntimeLeaseError>
pub fn attach( &mut self, client_id: RuntimeClientId, authorization: &RuntimeAuthorization, now_ms: u64, ) -> Result<RuntimeLeaseSnapshot, RuntimeLeaseError>
Register or refresh one authenticated observer.
Sourcepub fn heartbeat(
&mut self,
client_id: &RuntimeClientId,
authorization: &RuntimeAuthorization,
now_ms: u64,
) -> Result<RuntimeLeaseSnapshot, RuntimeLeaseError>
pub fn heartbeat( &mut self, client_id: &RuntimeClientId, authorization: &RuntimeAuthorization, now_ms: u64, ) -> Result<RuntimeLeaseSnapshot, RuntimeLeaseError>
Refresh observation activity without changing controller ownership.
Validate a non-controller capability. Observation and lifecycle
administration are authorized independently from turn ownership;
interactive and approval mutations must use
Self::authorize_controller instead.
Sourcepub fn claim_control(
&mut self,
client_id: RuntimeClientId,
authorization: &RuntimeAuthorization,
now_ms: u64,
) -> Result<RuntimeLeaseSnapshot, RuntimeLeaseError>
pub fn claim_control( &mut self, client_id: RuntimeClientId, authorization: &RuntimeAuthorization, now_ms: u64, ) -> Result<RuntimeLeaseSnapshot, RuntimeLeaseError>
Claim the controller when unowned, or renew it when already owned by this client. Another live controller is never displaced implicitly.
Sourcepub fn take_control(
&mut self,
client_id: RuntimeClientId,
authorization: &RuntimeAuthorization,
now_ms: u64,
) -> Result<RuntimeLeaseSnapshot, RuntimeLeaseError>
pub fn take_control( &mut self, client_id: RuntimeClientId, authorization: &RuntimeAuthorization, now_ms: u64, ) -> Result<RuntimeLeaseSnapshot, RuntimeLeaseError>
Explicitly transfer control to another authorized interactive client.
Validate and renew mutation authority for client_id.
Sourcepub fn detach(
&mut self,
client_id: &RuntimeClientId,
now_ms: u64,
) -> RuntimeLeaseSnapshot
pub fn detach( &mut self, client_id: &RuntimeClientId, now_ms: u64, ) -> RuntimeLeaseSnapshot
Remove an observer and release its controller lease, if held.
Sourcepub fn snapshot(&mut self, now_ms: u64) -> RuntimeLeaseSnapshot
pub fn snapshot(&mut self, now_ms: u64) -> RuntimeLeaseSnapshot
Current state after deterministic expiry reconciliation.