Skip to main content

SourceEngine

Struct SourceEngine 

Source
pub struct SourceEngine<S> { /* private fields */ }
Expand description

One-in-flight source engine with at-least-once replay semantics.

Implementations§

Source§

impl<S> SourceEngine<S>
where S: ChainDataSource,

Source

pub fn new( source: S, desired_state: ApplyDesiredState, committed_next_block: u64, activation_block: u64, reorg_depth: usize, ) -> Self

Create an engine at an acknowledged block cursor.

Source

pub fn restore( source: S, desired_state: ApplyDesiredState, resume: SourceResume, reorg_depth: usize, ) -> Result<Self, SourceEngineError>

Restore an engine from a mutually consistent cursor, canonical suffix, and provider checkpoint.

§Errors

Returns SourceEngineError when retained canonical history, provider checkpoint, scan cursor, activation metadata, or coverage head are malformed or mutually inconsistent.

Source

pub fn with_max_delivery_bytes( self, max_delivery_bytes: usize, ) -> Result<Self, SourceEngineError>

Override the encoded delivery budget, primarily for stricter deployments and tests.

§Errors

Returns SourceEngineError::InvalidDeliverySizeLimit when the limit is zero or exceeds MAX_DELIVERY_SIZE_BYTES.

Source

pub fn with_response_limits(self, response_limits: SourceResponseLimits) -> Self

Override the hard local decoded-response admission policy.

Source

pub async fn next_batch( &mut self, to_block_excl: u64, ) -> Result<Option<Delivery>, SourceEngineError>

Fetch the next page up to an exclusive target, replaying an unacknowledged page without another provider request.

§Errors

Returns SourceEngineError for query/source failure, invalid or oversized provider data, unresolvable continuity/reorg state, sequence exhaustion, or an owner-only fork protocol v1 cannot represent.

Source

pub fn acknowledge( &mut self, delivery_token: &[u8], ) -> Result<(), SourceEngineError>

Commit the only in-flight delivery token and advance the durable cursor.

§Errors

Returns SourceEngineError::NoPendingDelivery when nothing is in flight, SourceEngineError::DeliveryTokenMismatch for the wrong token, or SourceEngineError::MissingCursor for an invalid pending delivery.

Source

pub fn committed_next_block(&self) -> u64

Exclusive block cursor durably acknowledged by the consumer.

Source

pub fn activation_cursor(&self) -> Result<Cursor, SourceEngineError>

Cursor persisted on the desired-state activation barrier before the first provider page is requested.

§Errors

Returns SourceEngineError when retained canonical/provider checkpoint metadata cannot be encoded safely.

Source

pub fn committed_sequence(&self) -> u64

Last batch sequence durably acknowledged by the consumer.

Source

pub fn acknowledge_external_control( &mut self, sequence: u64, ) -> Result<(), SourceEngineError>

Advance sequence across a service-generated control that does not touch this source’s provider cursor.

§Errors

Returns SourceEngineError::PendingDelivery while a source delivery is in flight, or SourceEngineError::SequenceRegression if sequence moves behind committed authority.

Source

pub fn synchronize_committed_cursor( &mut self, resume: SourceResume, ) -> Result<(), SourceEngineError>

Synchronize an engine rebuilt from an older acknowledged cursor after a separately persisted outbox delivery is committed.

§Errors

Returns SourceEngineError when a delivery is pending, sequence authority regresses, or the replacement cursor/checkpoint/history/ coverage state is malformed or inconsistent. Validation completes before engine state is replaced.

Source

pub fn activation_block(&self) -> u64

First block routed to all live owners for the active revision.

Source

pub fn source(&self) -> &S

Access the source, primarily for lifecycle and height-stream drivers.

Auto Trait Implementations§

§

impl<S> Freeze for SourceEngine<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for SourceEngine<S>
where S: RefUnwindSafe,

§

impl<S> Send for SourceEngine<S>
where S: Send,

§

impl<S> Sync for SourceEngine<S>
where S: Sync,

§

impl<S> Unpin for SourceEngine<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for SourceEngine<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for SourceEngine<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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