pub struct MaintenanceMode { /* private fields */ }Expand description
Maintenance-mode state backed by a file, so down in one process takes
effect in a running server within a second.
Every request reads it, so while the app is up it takes no lock: the state is an atomic flag, and the time of the last check an atomic timestamp that one request at a time claims to re-read the file.
Implementations§
Source§impl MaintenanceMode
impl MaintenanceMode
Sourcepub async fn current(&self) -> Option<MaintenanceInfo>
pub async fn current(&self) -> Option<MaintenanceInfo>
The current maintenance state; None when the app is up. Reads the
file at most once per second (one request refreshes, others reuse).
Sourcepub async fn down(&self, info: MaintenanceInfo) -> Result<()>
pub async fn down(&self, info: MaintenanceInfo) -> Result<()>
Puts the app into maintenance: writes the file and updates this process.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MaintenanceMode
impl Forget for MaintenanceMode
impl Move for MaintenanceMode
impl RefUnwindSafe for MaintenanceMode
impl Send for MaintenanceMode
impl Sync for MaintenanceMode
impl Unpin for MaintenanceMode
impl UnsafeUnpin for MaintenanceMode
impl UnwindSafe for MaintenanceMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more