pub struct AgentMaintenance { /* private fields */ }Expand description
Owned maintenance role. Await shutdown for joined completion; Drop only
initiates cleanup. An OS supervisor must bound non-yielding host code.
use std::sync::Arc;
use stateknot_runtime::{agent_maintenance::*, JsonSchemaRegistry};
use stateknot_core::TenantId;
use stateknot_store_postgres::PostgresStore;
async fn start(store: PostgresStore, schemas: JsonSchemaRegistry,
tenants: Vec<TenantId>, host: Arc<dyn AgentMaintenanceReadiness>)
-> Result<AgentMaintenance, AgentMaintenanceError> {
let binding = AgentMaintenanceBinding::new(store, schemas, tenants,
AgentMaintenanceMutationOptions::default())?;
AgentMaintenance::start(binding, host, AgentMaintenanceOptions::default()).await
}Implementations§
Source§impl AgentMaintenance
impl AgentMaintenance
Sourcepub async fn start(
binding: AgentMaintenanceBinding,
host: Arc<dyn AgentMaintenanceReadiness>,
options: AgentMaintenanceOptions,
) -> Result<Self, AgentMaintenanceError>
pub async fn start( binding: AgentMaintenanceBinding, host: Arc<dyn AgentMaintenanceReadiness>, options: AgentMaintenanceOptions, ) -> Result<Self, AgentMaintenanceError>
Checks actual dependencies before spawning any maintenance task. Failed or cancelled startup performs no durable mutation and claims no work.
Sourcepub fn health(&self) -> AgentMaintenanceHealth
pub fn health(&self) -> AgentMaintenanceHealth
Payload-free cached health without retaining store or schema handles.
Sourcepub fn begin_shutdown(&self)
pub fn begin_shutdown(&self)
Synchronously closes admission; does not request durable Run cancellation.
Sourcepub async fn wait(
&mut self,
) -> Result<AgentMaintenanceReport, AgentMaintenanceError>
pub async fn wait( &mut self, ) -> Result<AgentMaintenanceReport, AgentMaintenanceError>
Cancellation-safe joined wait; a cancelled wait retains coordinator ownership.
Sourcepub async fn shutdown(
&mut self,
) -> Result<AgentMaintenanceReport, AgentMaintenanceError>
pub async fn shutdown( &mut self, ) -> Result<AgentMaintenanceReport, AgentMaintenanceError>
Requests shutdown, then joins all owned tasks including forced cancellation.
Trait Implementations§
Source§impl Drop for AgentMaintenance
impl Drop for AgentMaintenance
Auto Trait Implementations§
impl Forget for AgentMaintenance
impl Freeze for AgentMaintenance
impl Move for AgentMaintenance
impl RefUnwindSafe for AgentMaintenance
impl Send for AgentMaintenance
impl Sync for AgentMaintenance
impl Unpin for AgentMaintenance
impl UnsafeUnpin for AgentMaintenance
impl UnwindSafe for AgentMaintenance
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more