pub struct IntentSupervisor { /* private fields */ }Expand description
Starts synchronization intents and restarts failed intents with bounded exponential backoff.
Implementations§
Source§impl IntentSupervisor
impl IntentSupervisor
pub const fn new( max_retries: u32, backoff_base: Duration, backoff_max: Duration, ) -> Self
Sourcepub async fn run_intent(
&self,
sync: &SyncEngine,
namespace: NamespaceId,
params: SubscribeParams,
) -> SupervisedIntent
pub async fn run_intent( &self, sync: &SyncEngine, namespace: NamespaceId, params: SubscribeParams, ) -> SupervisedIntent
Start one continuous intent and record any startup failure.
Sourcepub async fn run_intent_with_filter(
&self,
sync: &SyncEngine,
namespace: NamespaceId,
params: SubscribeParams,
filter_engine: Option<FilterEngine>,
) -> SupervisedIntent
pub async fn run_intent_with_filter( &self, sync: &SyncEngine, namespace: NamespaceId, params: SubscribeParams, filter_engine: Option<FilterEngine>, ) -> SupervisedIntent
Start one filtered synchronization intent.
Sourcepub async fn supervise(
&self,
sync: &SyncEngine,
namespace: NamespaceId,
params: SubscribeParams,
shutdown: Receiver<()>,
) -> Result<SupervisedIntent>
pub async fn supervise( &self, sync: &SyncEngine, namespace: NamespaceId, params: SubscribeParams, shutdown: Receiver<()>, ) -> Result<SupervisedIntent>
Supervise one intent until shutdown or until its retry budget is spent.
A normal Finished or Cancelled event ends supervision. A Failed
event, an unexpectedly closed stream, or a startup error consumes one
retry and restarts the intent after backoff.
§Errors
Returns an error if supervision infrastructure fails while waiting for shutdown or retrying an intent.
Sourcepub async fn supervise_with_controls(
&self,
sync: &SyncEngine,
namespace: NamespaceId,
params: SubscribeParams,
shutdown: Receiver<()>,
controls: Arc<Mutex<HashMap<NamespaceId, IntentControl>>>,
filter: Option<FilterEngine>,
) -> Result<SupervisedIntent>
pub async fn supervise_with_controls( &self, sync: &SyncEngine, namespace: NamespaceId, params: SubscribeParams, shutdown: Receiver<()>, controls: Arc<Mutex<HashMap<NamespaceId, IntentControl>>>, filter: Option<FilterEngine>, ) -> Result<SupervisedIntent>
Supervise an intent while exposing pause/resume controls to its owner.
§Errors
Returns an error if the shared control registry is poisoned or the intent supervision infrastructure cannot wait for shutdown.
Sourcepub fn backoff_delay(&self, retry_number: u32) -> Duration
pub fn backoff_delay(&self, retry_number: u32) -> Duration
Return the delay for a one-based retry number.
Trait Implementations§
Source§impl Clone for IntentSupervisor
impl Clone for IntentSupervisor
Source§fn clone(&self) -> IntentSupervisor
fn clone(&self) -> IntentSupervisor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for IntentSupervisor
Auto Trait Implementations§
impl Freeze for IntentSupervisor
impl RefUnwindSafe for IntentSupervisor
impl Send for IntentSupervisor
impl Sync for IntentSupervisor
impl Unpin for IntentSupervisor
impl UnsafeUnpin for IntentSupervisor
impl UnwindSafe for IntentSupervisor
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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> ⓘ
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> ⓘ
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