Skip to main content

SubscriptionSnapshot

Struct SubscriptionSnapshot 

Source
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

Source

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).

Source

pub fn frontier(&self) -> EventSequence

The stream frontier as of this load — the highest sequence the outbox had handed out (semantics 2).

Source

pub fn stream_status(&self) -> SubscriptionStreamStatus

The { checkpoint, frontier } pair.

Source

pub fn lag(&self) -> u64

How far the handler trails the frontier, saturating at zero.

Source

pub fn is_caught_up(&self) -> bool

Whether the checkpoint has reached the frontier.

Source

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.

Source

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.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more