Skip to main content

DeliveryState

Struct DeliveryState 

Source
struct DeliveryState {
    deliveries: HashMap<DeliveryKey, Delivery>,
    fallback_claims: HashMap<(String, Reason), i64>,
    fallbacks: HashMap<String, FallbackDelivery>,
    boundary_origins: VecDeque<(String, String, i64)>,
    completed: HashMap<(String, Reason), i64>,
}
Expand description

Deliveries and fallback claims, behind one lock so “who claimed this event first” is decided atomically.

Fields§

§deliveries: HashMap<DeliveryKey, Delivery>§fallback_claims: HashMap<(String, Reason), i64>

Events the frontend’s hidden-reinjection fallback claimed: (block, reason) → when.

§fallbacks: HashMap<String, FallbackDelivery>

Re-deliveries srv composed for the frontend’s fallback, by delivery_id, until the hidden message that sends one arrives.

§boundary_origins: VecDeque<(String, String, i64)>

Which block’s CLI wrote each compaction boundary, and when: (uuid, block, ms), oldest first.

§completed: HashMap<(String, Reason), i64>

The newest hook delivery each (block, reason) finished: when it was composed. Unlike deliveries it isn’t pruned, so a fallback deferred behind a long turn still finds it. One entry per block and reason.

Implementations§

Source§

impl DeliveryState

Source

fn prune(&mut self, now: i64)

Source

fn fallback_claimed(&self, block_id: &str, reason: Reason) -> bool

Source

fn hook_deliveries_mut( &mut self, block_id: &str, reason: Reason, now: i64, since: i64, ) -> Vec<&mut Delivery>

The hook’s deliveries of this event, newest first: inside the claim window and created after since.

Source

fn claim_fallback( &mut self, block_id: &str, reason: Reason, now: i64, since: i64, ) -> FallbackClaim

The fallback’s atomic claim on an event. A Deliver for an unclaimed event records the claim, so the hook’s parts for it come back empty. Hook deliveries created at or before since belong to an earlier event.

Source

fn record_boundary(&mut self, uuid: &str, block_id: &str, now: i64)

Source

fn claim_boundary( &mut self, block_id: &str, reason: Reason, boundary_uuid: Option<&str>, now: i64, ) -> FallbackClaim

A claim naming its compaction boundary. Only the block whose own CLI wrote the boundary may deliver: another block of the agent reads it from the shared transcript zone, and its CLI did not compact. A boundary no stdout here wrote (another srv instance’s) is not this block’s either. A hook delivery from before the block’s previous boundary was that compaction’s, not this one’s.

Source

fn claim_event( &mut self, block_id: &str, reason: Reason, event_at: i64, now: i64, ) -> FallbackClaim

A claim dated by its event: a fresh session, at its agentmux_session_outcome frame’s timestamp (srv’s own clock). A hook delivery composed after the event and finished is that event’s however long ago, so a fallback deferred behind the session’s first turn stands down even past CLAIM_WINDOW_MS. One from before it was an earlier session’s and doesn’t count.

Source

fn note_completed(&mut self, key: &DeliveryKey, created_ms: i64)

The hook finished a delivery: its notice went out.

Source

fn take_over_from_hook(&mut self, block_id: &str, reason: Reason, now: i64)

The fallback gave up waiting for the hook: it delivers, and the hook’s unfinished delivery is closed so a late acknowledgement adds no second notice.

Trait Implementations§

Source§

impl Default for DeliveryState

Source§

fn default() -> DeliveryState

Returns the “default value” for a type. 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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

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

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

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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

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

§

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
§

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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