pub struct SubscriptionSnapshot { /* private fields */ }Expand description
A point-in-time view of a registered handler, produced by
Subscription::load.
One load() pairs the handler’s committed checkpoint with the stream
frontier, so every accessor below is synchronous and infallible — a
consumer reading several of them pays one round-trip, not one per
question. Nothing is cached: a fresh load() always reflects the latest
committed state.
The checkpoint is decoded eagerly during load() (obix knows the handler
job’s state type, so there is no reason to defer it to the caller), which
is why these accessors cannot fail.
Implementations§
Source§impl SubscriptionSnapshot
impl SubscriptionSnapshot
Sourcepub fn checkpoint(&self) -> EventSequence
pub fn checkpoint(&self) -> EventSequence
The handler’s committed checkpoint: every persistent event with a
sequence at or below this has been handled and its effects committed
(semantics 1). A handler that has never checkpointed reads as
EventSequence::BEGIN (semantics 4).
Sourcepub fn frontier(&self) -> EventSequence
pub fn frontier(&self) -> EventSequence
The stream frontier as of this load — the highest sequence the outbox had handed out (semantics 2).
Sourcepub fn stream_status(&self) -> SubscriptionStreamStatus
pub fn stream_status(&self) -> SubscriptionStreamStatus
The { checkpoint, frontier } pair.
Sourcepub fn is_caught_up(&self) -> bool
pub fn is_caught_up(&self) -> bool
Whether the checkpoint has reached the frontier.
Sourcepub fn job_status(&self) -> JobStatus
pub fn job_status(&self) -> JobStatus
Runtime status of the job hosting this handler.
A resident handler job stays Running; a terminal status means the
handler is no longer consuming, which is the case
Subscription::await_caught_up reports as a timeout rather than a
hang.
Sourcepub fn last_error(&self) -> Option<&str>
pub fn last_error(&self) -> Option<&str>
The handler’s most recent failure, if it has ever failed an attempt.
This is the wedged-vs-slow signal. obix registers handlers to
retry indefinitely, so a handler crash-looping on a poison event never
reaches a terminal state: job_status keeps
reporting Pending/Running while the checkpoint sits frozen. A
lagging handler with Some here — especially with
attempt climbing across successive loads — is stuck
on this error, not merely backlogged.
None means no attempt has ever failed. A stale Some from an
earlier, since-recovered failure is possible, which is why the pair
with a frozen checkpoint (or a rising attempt) is what diagnoses.
Sourcepub fn attempt(&self) -> Option<u32>
pub fn attempt(&self) -> Option<u32>
The current attempt number — Some only while the job has a live
execution row. Rising across loads means the handler is retrying; see
last_error.
Sourcepub fn job(&self) -> &JobSnapshot
pub fn job(&self) -> &JobSnapshot
The underlying job snapshot, for callers that want the job’s own accessors (next run, queue id, config, return value).
Auto Trait Implementations§
impl Freeze for SubscriptionSnapshot
impl RefUnwindSafe for SubscriptionSnapshot
impl Send for SubscriptionSnapshot
impl Sync for SubscriptionSnapshot
impl Unpin for SubscriptionSnapshot
impl UnsafeUnpin for SubscriptionSnapshot
impl UnwindSafe for SubscriptionSnapshot
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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