Skip to main content

OutboxBuilder

Struct OutboxBuilder 

Source
pub struct OutboxBuilder { /* private fields */ }
Expand description

One batch’s outbox edits, using a single snapshot of os and oc.

The fixed infallible fragment methods defer malformed inputs/overflow until finish. try_finish reports these errors without changing its output vectors. finish instead appends mutually exclusive guards, making the entire caller batch fail closed with no writes applied. Use one builder per batch, finishing it before any acknowledgements.

Implementations§

Source§

impl OutboxBuilder

Source

pub fn new(os: Option<&Value>, oc: Option<&Value>) -> Result<Self, StoreError>

Read sequence/backlog once. Missing rows mean zero.

Source

pub fn reserve(&mut self, rid: &str, ticket_id: [u8; 32], prior: Option<&Value>)

Reserve a unique id. An existing row fails Absent at commit even when it contains the same ticket; callers resolve replay beforehand.

Source

pub fn pending( &mut self, rid: &str, prior: Option<&Value>, record: &ReservationV1, )

Durably record an admitted reservation before any guarded apply. A present prior is an invalid admission decision, not a replay.

Source

pub fn outcome(&mut self, rid: &str, prior: &Value, terminal: Terminal)

Replace still-Ticketed or Pending with exactly one terminal outcome, queued for delivery. A terminal prior is rejected rather than replaced.

Source

pub fn abort_direct(&mut self, rid: &str, terminal: Terminal)

Fail a ticketless streaming reservation in one guarded Absent unit.

Source

pub fn relay_at(&mut self, now_ms: u64)

Stamp relay rows and schedule their immediate source-side kick.

Source

pub fn relay(&mut self, target: &Partition, puts: Vec<(Key, Value)>)

Group idempotent upserts by target, sorting keys deterministically. Conflicting values for one target/key invalidate the whole fragment.

Source

pub fn relay_delete(&mut self, target: &Partition, keys: Vec<Key>)

Group idempotent deletes by target. A key cannot be both put and deleted in the same source batch.

Source

pub fn try_finish( self, pre: &mut Vec<Precondition>, writes: &mut Vec<Write>, ) -> Result<(), StoreError>

Finish with error reporting. Errors leave output vectors unchanged.

Source

pub fn finish(self, pre: &mut Vec<Precondition>, writes: &mut Vec<Write>)

Finish the fixed fragment API; malformed input makes the caller’s complete batch uncommittable, which looks like a retryable conflict. Wiring code (WP-1.9, 1.10, 1.14, 3.3) MUST call try_finish so the error is reported instead.

Trait Implementations§

Source§

impl Debug for OutboxBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> 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> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSync for T
where T: Sync + ?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<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