Skip to main content

Multiplexer

Struct Multiplexer 

Source
pub struct Multiplexer {
    SideCarIdentifier: String,
    Sink: Sender<Envelope>,
    Pending: Arc<DashMap<u64, Sender<GenericResponse>>>,
    NextRequestIdentifier: AtomicU64,
    Closed: AtomicBool,
}
Expand description

One multiplexer per sidecar connection. Holds the outbound sink, the pending-request correlation map, and a shared-state shutdown flag.

Fields§

§SideCarIdentifier: String§Sink: Sender<Envelope>§Pending: Arc<DashMap<u64, Sender<GenericResponse>>>§NextRequestIdentifier: AtomicU64§Closed: AtomicBool

Implementations§

Source§

impl Multiplexer

Source

pub async fn Open( SideCarIdentifier: String, Client: CocoonServiceClient<Channel>, ) -> Result<Arc<Self>, VineError>

Open a bidirectional streaming channel against an existing CocoonServiceClient. Spawns the read pump as a detached tokio task and registers the multiplexer in the global registry. Returns once the stream is established.

Source

pub fn Lookup(SideCarIdentifier: &str) -> Option<Arc<Self>>

Look up the multiplexer for a sidecar. Returns None if no streaming connection has been opened for that sidecar (the caller should fall back to the unary path).

Source

pub fn Deregister(SideCarIdentifier: &str)

Drop the registry entry. Called by the read-pump when the stream closes.

Source

pub async fn Notify( &self, Method: String, Parameters: Value, ) -> Result<(), VineError>

Send a notification frame (fire-and-forget). Non-blocking modulo Sink backpressure (capacity SINK_CAPACITY).

Source

pub async fn Request( &self, Method: String, Parameters: Value, Timeout: Duration, ) -> Result<Value, VineError>

Send a request and await the matching response. Cancels the pending entry on timeout. The future is Send + 'static-clean so callers can drive it inside tokio::select! for finer- grained cancellation.

Source

pub async fn Cancel(&self, RequestIdentifier: u64) -> Result<(), VineError>

Send a Cancel frame asking the peer to abort an in-flight request matching RequestIdentifier. Best-effort; the peer chooses whether to honour it.

Source

pub fn IsClosed(&self) -> bool

Source

pub fn SideCarIdentifierBorrow(&self) -> &str

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.

§

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.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

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

impl<L> LayerExt<L> for L

§

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

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

§

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

§

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