Skip to main content

SessionMessenger

Struct SessionMessenger 

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

Validates logical identity, atomically enqueues, then requests one runtime activation. The service owns no process-global registry.

Implementations§

Source§

impl SessionMessenger

Source

pub fn new( sessions: Arc<dyn Storage>, inbox: Arc<dyn SessionInboxPort>, activation: Arc<dyn SessionActivationPort>, ) -> Self

Source

pub fn inbox(&self) -> &Arc<dyn SessionInboxPort> ⓘ

Source

pub fn activation(&self) -> &Arc<dyn SessionActivationPort> ⓘ

Source

pub fn metrics(&self) -> &Arc<SessionMessagingMetrics> ⓘ

Source

pub async fn list_peer_targets( &self, caller_session_id: &str, ) -> Result<SessionPeerTargets, SessionMessengerError>

Discover bounded logical peers in the caller’s current canonical tree. caller_session_id comes from the authenticated runtime context, never from model arguments. Every candidate is revalidated before disclosure.

Source

pub async fn send_peer( &self, caller_session_id: &str, target_session_id: &str, operation_id: &str, message: &str, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

Send an asynchronous peer instruction. Source identity and association fields are constructed by the runtime; callers provide no envelope. Reuse the same operation id and message after an uncertain result.

Source

pub async fn send_peer_with_intent( &self, caller_session_id: &str, target_session_id: &str, operation_id: &str, message: &str, intent: SessionMessageDeliveryIntent, ) -> Result<SessionPeerDeliveryReceipt, SessionMessengerError>

Explicit scheduling over the same lifetime-fenced Inbox. Omission on the old send_peer API keeps legacy interrupt/activation behavior.

Source

pub async fn send_peer_observed( &self, caller: &SessionCallerReference, target_session_id: &str, operation_id: &str, message: &str, intent: Option<SessionMessageDeliveryIntent>, ) -> Result<SessionPeerDeliveryReceipt, SessionMessengerError>

Canonical compatibility send from the original executing caller. The final Inbox retains a never-installed Host namespace plus the existing peer lifecycle/Project authority. An installed/revoked scope refuses this fallback; use the explicitly scoped sender for that namespace.

Source

pub async fn send_host_scoped_peer( &self, token: &HostSessionScopeToken, caller: &SessionCallerReference, target_session_id: &str, operation_id: &str, message: &str, intent: SessionMessageDeliveryIntent, ) -> Result<SessionPeerDeliveryReceipt, SessionMessengerError>

One explicitly installed SendPeer grant, including independent Roots. No inspect right or public target read is needed to build this bounded envelope. The Inbox validates the original caller and token at its final retained authority boundary; these binding bytes are observations only.

Source

pub async fn send_host_root_first_input( &self, token: &HostSessionScopeToken, caller: &SessionCallerReference, operation_id: Uuid, reserved_root: &Session, message: &str, ) -> Result<SessionPeerDeliveryReceipt, SessionMessengerError>

Admit the first input for one explicitly authorized Root creation. This is not the SendPeer port: no target grant or relationship is inferred. A known durable receipt survives a later activation failure unchanged.

Source

pub async fn supervisor_root_first_input_observed( &self, caller: &SessionCallerReference, supervisor: &SupervisorReference, operation_id: Uuid, reserved_root: &Session, message: &str, ) -> Result<SessionPeerDeliveryReceipt, SessionMessengerError>

Canonical generic-caller Supervisor creation keeps its old wire but uses current pending state, unlike the independent legacy followup API.

Source

pub async fn steer_peer( &self, caller_session_id: &str, target_session_id: &str, operation_id: &str, message: &str, expected_run_id: &str, ) -> Result<SessionInboxSteerReceipt, SessionMessengerError>

Active-run-only peer input. The Inbox owns exact retry recovery and retains its original authority through the runtime’s publication CAS. This never cancels a run, requests activation or reconstructs an owner.

Source

pub async fn reply_peer( &self, caller_session_id: &str, received_message_id: &str, operation_id: &str, message: &str, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

Reply only to a canonical received peer envelope in the caller’s saved transcript. Recipient and thread edges are never supplied by the model.

Source

pub async fn reply_peer_with_intent( &self, caller_session_id: &str, received_message_id: &str, operation_id: &str, message: &str, intent: SessionMessageDeliveryIntent, ) -> Result<SessionPeerDeliveryReceipt, SessionMessengerError>

Derive recipient/thread from the canonical received peer message while opting into explicit scheduling. Reply observations never grant authority.

Source

pub async fn supervisor_loop_control( &self, supervisor: &SupervisorReference, target_session_id: &str, expected_link_revision: Option<u64>, command: &LoopControlRequest, receipt_operation_id: Option<&str>, ) -> Result<Value, SessionMessengerError>

Original executing Supervisor control over one separately host-granted live Root. Enqueue/notification is never a configuration application receipt. Reads use a fresh canonical target snapshot under both fences.

Source

pub async fn supervisor_current_user_followup( &self, caller: &SessionCallerReference, supervisor: &SupervisorReference, target: &SupervisorCurrentUserTarget, operation_id: &str, message: &str, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

Current-user management always retains the immutable selected target and full original caller through the existing physical Inbox writer.

Source

pub async fn supervisor_followup( &self, supervisor: &SupervisorReference, target: &Session, operation_id: &str, message: &str, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

Follow an originally observed Session from the canonical Supervisor. Retain its birth across retries. The concrete Inbox revalidates all authority under physical locks; a fresh ID lookup cannot replace it.

Source

pub async fn supervisor_followup_observed( &self, caller: &SessionCallerReference, supervisor: &SupervisorReference, target: &Session, operation_id: &str, message: &str, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

Canonical sender fallback only. Its Inbox holds a real never-installed namespace guard and the complete original caller through admission.

Source

pub async fn admit( &self, envelope: SessionMessageEnvelope, ) -> Result<SessionMessengerAdmission, SessionMessengerError>

Source

pub async fn admit_with_gate( &self, envelope: SessionMessageEnvelope, gate: Option<&AdmissionGate>, ) -> Result<SessionMessengerAdmission, SessionMessengerError>

Source

pub async fn admit_with_activation_intent( &self, envelope: SessionMessageEnvelope, policy: SessionActivationPolicy, gate: Option<&AdmissionGate>, ) -> Result<SessionMessengerAdmission, SessionMessengerError>

Commit this specific message’s immediate permission together with the envelope. Coordinators continue to use staged admit.

Source

pub async fn activate( &self, admission: &SessionMessengerAdmission, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

Source

pub async fn activate_with_policy( &self, admission: &SessionMessengerAdmission, policy: SessionActivationPolicy, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

Source

pub async fn activate_prepared( &self, admission: &SessionMessengerAdmission, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

Request execution for an admission whose activation policy was already durably recorded by a coordinator.

Source

pub async fn prepare_activation( &self, admission: &SessionMessengerAdmission, ) -> Result<(), SessionMessengerError>

Durably authorize the admitted queue prefix before a related control-plane transition is committed.

Coordinators call this while their specific wait is still armed, then checkpoint the wait clear, and finally call activate. A crash in either gap is recoverable: startup sees the watermark, while the real reservation adapter refuses to run until the specific wait has been durably cleared.

Source

pub async fn prepare_message_activation( &self, admission: &SessionMessengerAdmission, policy: SessionActivationPolicy, ) -> Result<(), SessionMessengerError>

Authorize one staged delivery, preserving its immutable delivery intent and every sibling’s existing execution permission.

Source

pub async fn send( &self, envelope: SessionMessageEnvelope, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

Source

pub async fn send_with_gate( &self, envelope: SessionMessageEnvelope, gate: Option<&AdmissionGate>, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

Source

pub async fn send_with_policy( &self, envelope: SessionMessageEnvelope, policy: SessionActivationPolicy, ) -> Result<SessionMessengerReceipt, SessionMessengerError>

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