Skip to main content

MaintenancePlugin

Struct MaintenancePlugin 

Source
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.

Source

pub fn new(config: MaintenanceConfig) -> Self

Compiles a standalone MaintenancePlugin from config.

§Arguments
  • MaintenanceConfig - Maintenance policy.
§Returns
  • Self - Compiled lock-free maintenance gate.
Source

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.
Source

pub fn get() -> Option<&'static Self>

Returns the initialized global MaintenancePlugin, if configured.

§Returns
  • Option<&'static Self> - Reference to the global plugin, or None.
Source

pub fn get_config(&self) -> &MaintenanceConfig

Returns the retained source configuration.

§Returns
  • &MaintenanceConfig - Source configuration.
Source

pub fn current_mode(&self) -> MaintenanceMode

Reads the current live MaintenanceMode with lock-free atomic acquire semantics.

§Returns
  • MaintenanceMode - Active operating mode.
Source

pub fn set_mode(&self, next: MaintenanceMode)

Atomically switches the live MaintenanceMode without restarting the server.

§Arguments
  • MaintenanceMode - New operating mode.
Source

pub fn switch_global_mode(next: MaintenanceMode) -> bool

Convenience helper updating the global singleton mode when initialized.

§Arguments
  • MaintenanceMode - New operating mode.
§Returns
  • bool - true when the global plugin was initialized and updated.
Source

pub fn is_path_exempt(&self, path: &str) -> bool

Reports whether path matches an exempt exact path or prefix.

§Arguments
  • &str - Incoming request path.
§Returns
  • bool - true when exempted.
Source

pub fn has_valid_bypass_token(&self, request: &Request) -> bool

Reports whether request presents a valid bypass secret token.

§Arguments
  • &Request - Incoming HTTP request.
§Returns
  • bool - true when a configured bypass token matches in constant time.
Source

pub fn evaluate(&self, request: &Request) -> MaintenanceDecision

Evaluates whether request is allowed, bypassed, or rejected.

§Arguments
  • &Request - Incoming HTTP request.
§Returns
  • MaintenanceDecision - Admission decision.
Source

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§

Source§

impl Debug for MaintenancePlugin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for MaintenancePlugin

§

impl Forget for MaintenancePlugin

§

impl Move for MaintenancePlugin

§

impl RefUnwindSafe for MaintenancePlugin

§

impl Send for MaintenancePlugin
where RawVecInner: Send, Atomic<u8>: Send, BoxRaw<[Box<[u8]>]>: Send, BoxRaw<[String]>: Send, RawTable<(String, ())>: Send,

§

impl Sync for MaintenancePlugin
where RawVecInner: Sync, Atomic<u8>: Sync, BoxRaw<[Box<[u8]>]>: Sync, BoxRaw<[String]>: Sync, RawTable<(String, ())>: Sync,

§

impl Unpin for MaintenancePlugin
where *const u8 is !null: Unpin, Align1<u8>: Unpin, Box<[Box<[u8]>]>: Unpin, Box<[String]>: Unpin,

§

impl UnsafeUnpin for MaintenancePlugin

§

impl UnwindSafe for MaintenancePlugin
where RawVecInner: UnwindSafe, Align1<u8>: UnwindSafe, BoxRaw<[Box<[u8]>]>: UnwindSafe, BoxRaw<[String]>: UnwindSafe, NonNull<u8>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnySend for T
where T: Any + Send,

Source§

impl<T> AnySendSync for T
where T: Any + Send + Sync,

Source§

impl<T> AnySync for T
where T: Any + Sync,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more