pub struct DurableChildJoinPublisher { /* private fields */ }Expand description
Trusted, tenant-scoped Join publisher; no node or provider code is dispatched.
Schedule alongside DurableChildReconciler and execution workers. The host
authenticates tenants, retains cursors, applies fairness, and alerts on errors.
No parent lease or transaction is retained between calls.
use stateknot_core::{CancellationSignal, TenantId};
use stateknot_runtime::{ChildJoinPublicationCursor, ChildJoinPublicationTick,
DurableChildJoinPublisher, DurableChildReconcilerOptions, JsonSchemaRegistryBuilder,
register_standard_child_join_event_schema};
use stateknot_store_postgres::{PostgresStore, StoreError};
fn configure(store: PostgresStore, mut schemas: JsonSchemaRegistryBuilder)
-> Result<DurableChildJoinPublisher, Box<dyn std::error::Error>> {
register_standard_child_join_event_schema(&mut schemas)?;
Ok(DurableChildJoinPublisher::new(store, schemas.build()?,
DurableChildReconcilerOptions::default())?)
}
async fn publish_step(worker: &DurableChildJoinPublisher, authorized_tenant: TenantId,
cursor: &mut Option<ChildJoinPublicationCursor>, shutdown: CancellationSignal)
-> Result<ChildJoinPublicationTick, StoreError> {
let report = worker.tick(authorized_tenant, cursor.clone(), shutdown).await?;
*cursor = Some(report.cursor().clone());
// Return the entire report to the host: inspect all item errors, apply
// fairness and cadence, and restart with None after process loss.
Ok(report)
}Implementations§
Source§impl DurableChildJoinPublisher
impl DurableChildJoinPublisher
Sourcepub fn new(
store: PostgresStore,
schemas: JsonSchemaRegistry,
options: DurableChildReconcilerOptions,
) -> Result<Self, ChildReconcilerBuildError>
pub fn new( store: PostgresStore, schemas: JsonSchemaRegistry, options: DurableChildReconcilerOptions, ) -> Result<Self, ChildReconcilerBuildError>
Requires the exact embedded schema and a finite validated retry policy.
Sourcepub fn tick(
&self,
tenant: TenantId,
after: Option<ChildJoinPublicationCursor>,
shutdown: CancellationSignal,
) -> BoxFuture<'_, Result<ChildJoinPublicationTick, StoreError>>
pub fn tick( &self, tenant: TenantId, after: Option<ChildJoinPublicationCursor>, shutdown: CancellationSignal, ) -> BoxFuture<'_, Result<ChildJoinPublicationTick, StoreError>>
Processes at most 16 eligible parents, continuing past each per-item error. Discovery failure fails the tick; retry from the last retained cursor. Shutdown can win during an ambiguous commit; subsequent reads converge.
Trait Implementations§
Source§impl Clone for DurableChildJoinPublisher
impl Clone for DurableChildJoinPublisher
Auto Trait Implementations§
impl !RefUnwindSafe for DurableChildJoinPublisher
impl !UnwindSafe for DurableChildJoinPublisher
impl Forget for DurableChildJoinPublisher
impl Freeze for DurableChildJoinPublisher
impl Move for DurableChildJoinPublisher
impl Send for DurableChildJoinPublisher
impl Sync for DurableChildJoinPublisher
impl Unpin for DurableChildJoinPublisher
impl UnsafeUnpin for DurableChildJoinPublisher
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