Skip to main content

LeaseControl

Trait LeaseControl 

Source
pub trait LeaseControl {
    // Required methods
    fn release(&self) -> Result<(), WarmSwapError>;
    fn reacquire(&self) -> Result<(), WarmSwapError>;
}
Expand description

Releases and re-acquires the single-writer per-conversation lease.

A warm swap releases the lease after draining and re-acquires it after the swap, so the swapped-in process is the sole writer with no split-brain window. In production this wraps the coordination.k8s.io/v1 Lease: release is the lease handle’s drop (clears holderIdentity) and reacquire is a fresh try_acquire.

Required Methods§

Source

fn release(&self) -> Result<(), WarmSwapError>

Release the lease held for this conversation.

§Errors

Returns WarmSwapError::Lease (with op = "release") when the lease cannot be released.

Source

fn reacquire(&self) -> Result<(), WarmSwapError>

Re-acquire the lease for this conversation.

§Errors

Returns WarmSwapError::Lease (with op = "re-acquire") when the lease cannot be re-acquired.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§