pub struct MaintenancePlugin { /* private fields */ }Expand description
Lock-free compiled maintenance gate backing MaintenanceHook.
Implementations§
Source§impl MaintenancePlugin
Compiled evaluation and runtime switching methods for MaintenancePlugin.
impl MaintenancePlugin
Compiled evaluation and runtime switching methods for MaintenancePlugin.
Sourcepub fn new(config: MaintenanceConfig) -> Self
pub fn new(config: MaintenanceConfig) -> Self
Compiles a standalone MaintenancePlugin from config.
§Arguments
MaintenanceConfig- Maintenance policy.
§Returns
Self- Compiled lock-free maintenance gate.
Sourcepub fn init(config: MaintenanceConfig) -> &'static Self
pub fn init(config: MaintenanceConfig) -> &'static Self
Initializes the global MaintenancePlugin singleton once.
§Arguments
MaintenanceConfig- Maintenance configuration.
§Returns
&'static Self- Reference to the global plugin.
Sourcepub fn get() -> Option<&'static Self>
pub fn get() -> Option<&'static Self>
Returns the initialized global MaintenancePlugin, if configured.
§Returns
Option<&'static Self>- Reference to the global plugin, orNone.
Sourcepub fn get_config(&self) -> &MaintenanceConfig
pub fn get_config(&self) -> &MaintenanceConfig
Sourcepub fn current_mode(&self) -> MaintenanceMode
pub fn current_mode(&self) -> MaintenanceMode
Reads the current live MaintenanceMode with lock-free atomic acquire semantics.
§Returns
MaintenanceMode- Active operating mode.
Sourcepub fn set_mode(&self, next: MaintenanceMode)
pub fn set_mode(&self, next: MaintenanceMode)
Atomically switches the live MaintenanceMode without restarting the server.
§Arguments
MaintenanceMode- New operating mode.
Sourcepub fn switch_global_mode(next: MaintenanceMode) -> bool
pub fn switch_global_mode(next: MaintenanceMode) -> bool
Sourcepub fn is_path_exempt(&self, path: &str) -> bool
pub fn is_path_exempt(&self, path: &str) -> bool
Sourcepub fn has_valid_bypass_token(&self, request: &Request) -> bool
pub fn has_valid_bypass_token(&self, request: &Request) -> bool
Sourcepub fn evaluate(&self, request: &Request) -> MaintenanceDecision
pub fn evaluate(&self, request: &Request) -> MaintenanceDecision
Sourcepub fn reject_wire(&self, decision: MaintenanceDecision) -> &[u8] ⓘ
pub fn reject_wire(&self, decision: MaintenanceDecision) -> &[u8] ⓘ
Returns the prebuilt rejection wire bytes for a rejected MaintenanceDecision.
§Arguments
MaintenanceDecision- Rejection decision.
§Returns
&[u8]- Pre-serialized HTTP wire bytes.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MaintenancePlugin
impl Forget for MaintenancePlugin
impl Move for MaintenancePlugin
impl RefUnwindSafe for MaintenancePlugin
impl Send for MaintenancePlugin
impl Sync for MaintenancePlugin
impl Unpin for MaintenancePlugin
impl UnsafeUnpin for MaintenancePluginwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
*const [Box<[u8]>] is !null: UnsafeUnpin,
PhantomData<[Box<[u8]>]>: UnsafeUnpin,
*const [String] is !null: UnsafeUnpin,
PhantomData<[String]>: UnsafeUnpin,
PhantomData<fn() -> XxHash3_64>: UnsafeUnpin,
PhantomData<(String, ())>: UnsafeUnpin,
impl UnwindSafe for MaintenancePluginwhere
RawVecInner: UnwindSafe,
Align1<u8>: UnwindSafe,
BoxRaw<[Box<[u8]>]>: UnwindSafe,
BoxRaw<[String]>: UnwindSafe,
NonNull<u8>: UnwindSafe,
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendSync for T
impl<T> AnySync for T
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