pub struct DurableRunFailureCloser { /* private fields */ }Expand description
Completes original failures after child cancellation/settlement reconciliation. The host must authorize tenants, supply fair recurring finite ticks, and inspect every error. No task is implicitly spawned. Direct evidence was frozen by the worker before lease release; this coordinator must not call providers again.
use stateknot_core::{CancellationSignal, TenantId};
use stateknot_runtime::{DurableRunFailureCloser, DurableGraphLifecycleOptions,
JsonSchemaRegistryBuilder, RunFailureCloseSweepCursor, RunFailureCloseTick,
register_standard_run_failure_close_event_schema};
use stateknot_store_postgres::{PostgresStore, StoreError};
fn configure(store: PostgresStore, mut schemas: JsonSchemaRegistryBuilder)
-> Result<DurableRunFailureCloser, Box<dyn std::error::Error>> {
register_standard_run_failure_close_event_schema(&mut schemas)?;
Ok(DurableRunFailureCloser::new(store, schemas.build()?,
DurableGraphLifecycleOptions::default())?)
}
async fn step(worker: &DurableRunFailureCloser, tenant: TenantId,
cursor: &mut Option<RunFailureCloseSweepCursor>, shutdown: CancellationSignal)
-> Result<RunFailureCloseTick, StoreError> {
let report = worker.tick(tenant, cursor.clone(), shutdown).await?;
*cursor = Some(report.cursor().clone());
// Inspect every item result; schedule another fair tick even after errors.
Ok(report)
}Implementations§
Source§impl DurableRunFailureCloser
impl DurableRunFailureCloser
Sourcepub fn new(
store: PostgresStore,
schemas: JsonSchemaRegistry,
options: DurableGraphLifecycleOptions,
) -> Result<Self, RunFailureCloseBuildError>
pub fn new( store: PostgresStore, schemas: JsonSchemaRegistry, options: DurableGraphLifecycleOptions, ) -> Result<Self, RunFailureCloseBuildError>
Requires the exact release schema and finite retry policy.
Sourcepub fn tick(
&self,
tenant: TenantId,
after: Option<RunFailureCloseSweepCursor>,
shutdown: CancellationSignal,
) -> BoxFuture<'_, Result<RunFailureCloseTick, StoreError>>
pub fn tick( &self, tenant: TenantId, after: Option<RunFailureCloseSweepCursor>, shutdown: CancellationSignal, ) -> BoxFuture<'_, Result<RunFailureCloseTick, StoreError>>
Independent of runnable discovery. A bad child/run does not starve later candidates.
Trait Implementations§
Source§impl Clone for DurableRunFailureCloser
impl Clone for DurableRunFailureCloser
Auto Trait Implementations§
impl !RefUnwindSafe for DurableRunFailureCloser
impl !UnwindSafe for DurableRunFailureCloser
impl Forget for DurableRunFailureCloser
impl Freeze for DurableRunFailureCloser
impl Move for DurableRunFailureCloser
impl Send for DurableRunFailureCloser
impl Sync for DurableRunFailureCloser
impl Unpin for DurableRunFailureCloser
impl UnsafeUnpin for DurableRunFailureCloser
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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