pub struct SubscriptionManager {
pub pending_acks: Arc<Mutex<HashMap<u64, Sender<Result<(), SubscriptionAckError>>>>>,
/* private fields */
}Fields§
§pending_acks: Arc<Mutex<HashMap<u64, Sender<Result<(), SubscriptionAckError>>>>>Implementations§
Source§impl SubscriptionManager
impl SubscriptionManager
pub fn new(tx: SlimChannelSender) -> Self
Sourcepub fn register_ack(&self) -> (u64, Receiver<Result<(), SubscriptionAckError>>)
pub fn register_ack(&self) -> (u64, Receiver<Result<(), SubscriptionAckError>>)
Register a pending ACK entry and return the ack_id and receiver.
The caller is responsible for building and sending the message with this ack_id.
If sending fails, call cancel_ack to clean up.
Sourcepub fn register_ack_with_id(
&self,
id: u64,
) -> Receiver<Result<(), SubscriptionAckError>>
pub fn register_ack_with_id( &self, id: u64, ) -> Receiver<Result<(), SubscriptionAckError>>
Register a pending ACK entry under a caller-provided ID and return the receiver.
Sourcepub fn cancel_ack(&self, ack_id: u64)
pub fn cancel_ack(&self, ack_id: u64)
Remove a previously registered pending ACK (call on send failure).
Sourcepub async fn await_ack(
ack_rx: Receiver<Result<(), SubscriptionAckError>>,
) -> Result<(), SubscriptionAckError>
pub async fn await_ack( ack_rx: Receiver<Result<(), SubscriptionAckError>>, ) -> Result<(), SubscriptionAckError>
Await a previously registered ACK receiver, with a deadline of [ACK_TIMEOUT].
Uses futures_timer::Delay rather than tokio::time::timeout so that
this function works correctly outside a Tokio runtime with the time driver
enabled (e.g. when called from UniFFI async bindings).
Sourcepub fn resolve_ack(&self, ack: &ProtoSubscriptionAck)
pub fn resolve_ack(&self, ack: &ProtoSubscriptionAck)
Called by the App message loop to complete a waiting future for an ACK.
Trait Implementations§
Source§impl Clone for SubscriptionManager
impl Clone for SubscriptionManager
Source§fn clone(&self) -> SubscriptionManager
fn clone(&self) -> SubscriptionManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl SubscriptionOps for SubscriptionManager
impl SubscriptionOps for SubscriptionManager
Source§fn subscribe<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 ProtoName,
name: &'life2 ProtoName,
forward_to: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<(u64, Receiver<Result<(), SubscriptionAckError>>), SubscriptionAckError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn subscribe<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 ProtoName,
name: &'life2 ProtoName,
forward_to: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<(u64, Receiver<Result<(), SubscriptionAckError>>), SubscriptionAckError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Subscribe (forward_to): register interest in
name, optionally routing
through a specific connection.Source§fn unsubscribe<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 ProtoName,
name: &'life2 ProtoName,
subscription_id: u64,
forward_to: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Result<(), SubscriptionAckError>>, SubscriptionAckError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn unsubscribe<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 ProtoName,
name: &'life2 ProtoName,
subscription_id: u64,
forward_to: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Result<(), SubscriptionAckError>>, SubscriptionAckError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Unsubscribe (forward_to): de-register interest in
name.Source§fn set_route<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 ProtoName,
name: &'life2 ProtoName,
conn: u64,
) -> Pin<Box<dyn Future<Output = Result<(u64, Receiver<Result<(), SubscriptionAckError>>), SubscriptionAckError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set_route<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 ProtoName,
name: &'life2 ProtoName,
conn: u64,
) -> Pin<Box<dyn Future<Output = Result<(u64, Receiver<Result<(), SubscriptionAckError>>), SubscriptionAckError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Set a recv_from route for
name on connection conn.Source§fn remove_route<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 ProtoName,
name: &'life2 ProtoName,
subscription_id: u64,
conn: u64,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Result<(), SubscriptionAckError>>, SubscriptionAckError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_route<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 ProtoName,
name: &'life2 ProtoName,
subscription_id: u64,
conn: u64,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Result<(), SubscriptionAckError>>, SubscriptionAckError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove a recv_from route for
name on connection conn.Source§fn from_slim_tx(tx: &SlimChannelSender) -> Option<Self>
fn from_slim_tx(tx: &SlimChannelSender) -> Option<Self>
Called during session stack construction to create a default instance
from the SLIM channel sender. Returns
None if this type requires
explicit construction (caller must call with_subscription_manager on
the builder).Auto Trait Implementations§
impl !RefUnwindSafe for SubscriptionManager
impl !UnwindSafe for SubscriptionManager
impl Freeze for SubscriptionManager
impl Send for SubscriptionManager
impl Sync for SubscriptionManager
impl Unpin for SubscriptionManager
impl UnsafeUnpin for SubscriptionManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request