Trait snocat::common::protocol::traits::TunnelRegistry [−][src]
pub trait TunnelRegistry: Downcast + DowncastSync { fn lookup_by_id(
&self,
tunnel_id: TunnelId
) -> BoxFuture<'_, Option<TunnelRecord>>; fn lookup_by_name(
&self,
tunnel_name: TunnelName
) -> BoxFuture<'_, Option<TunnelRecord>>; fn register_tunnel(
&self,
tunnel_id: TunnelId,
tunnel: Arc<dyn Tunnel + Send + Sync + Unpin + 'static>
) -> BoxFuture<'_, Result<(), TunnelRegistrationError>>; fn name_tunnel(
&self,
tunnel_id: TunnelId,
name: TunnelName
) -> BoxFuture<'_, Result<(), TunnelNamingError>>; fn deregister_tunnel(
&self,
tunnel_id: TunnelId
) -> BoxFuture<'_, Result<TunnelRecord, ()>>; }
Required methods
fn lookup_by_id(
&self,
tunnel_id: TunnelId
) -> BoxFuture<'_, Option<TunnelRecord>>
fn lookup_by_name(
&self,
tunnel_name: TunnelName
) -> BoxFuture<'_, Option<TunnelRecord>>
Called prior to authentication, a tunnel is not yet trusted and has no name, but the ID is guaranteed to remain stable throughout its lifetime.
Upon disconnection, [Self::drop_tunnel] will be called with the given TunnelId.
fn name_tunnel(
&self,
tunnel_id: TunnelId,
name: TunnelName
) -> BoxFuture<'_, Result<(), TunnelNamingError>>
fn name_tunnel(
&self,
tunnel_id: TunnelId,
name: TunnelName
) -> BoxFuture<'_, Result<(), TunnelNamingError>>
Called after authentication, when a tunnel is given an official designation May also be called later to allow a reconnecting tunnel to replaace its old record until that record is removed.
fn deregister_tunnel(
&self,
tunnel_id: TunnelId
) -> BoxFuture<'_, Result<TunnelRecord, ()>>
fn deregister_tunnel(
&self,
tunnel_id: TunnelId
) -> BoxFuture<'_, Result<TunnelRecord, ()>>
Called to remove a tunnel from the registry after it is disconnected. Does not immediately destroy the Tunnel; previous consumers can hold an Arc containing the Tunnel instance, which will extend its lifetime.
Implementations
Returns true if the trait object wraps an object of type __T
.
Returns a boxed object from a boxed trait object if the underlying object is of type
__T
. Returns the original boxed trait if it isn’t.
Returns an Rc
-ed object from an Rc
-ed trait object if the underlying object is of
type __T
. Returns the original Rc
-ed trait if it isn’t.
Returns a reference to the object within the trait object if it is of type __T
, or
None
if it isn’t.
Returns a mutable reference to the object within the trait object if it is of type
__T
, or None
if it isn’t.
pub fn downcast_arc<__T: TunnelRegistry>(
self: Arc<Self>
) -> Result<Arc<__T>, Arc<Self>> where
__T: Any + Send + Sync,
pub fn downcast_arc<__T: TunnelRegistry>(
self: Arc<Self>
) -> Result<Arc<__T>, Arc<Self>> where
__T: Any + Send + Sync,
Returns an Arc
-ed object from an Arc
-ed trait object if the underlying object is of
type __T
. Returns the original Arc
-ed trait if it isn’t.
Implementations on Foreign Types
fn register_tunnel(
&self,
tunnel_id: TunnelId,
tunnel: Arc<dyn Tunnel + Send + Sync + Unpin>
) -> BoxFuture<'_, Result<(), TunnelRegistrationError>>
fn name_tunnel(
&self,
tunnel_id: TunnelId,
name: TunnelName
) -> BoxFuture<'_, Result<(), TunnelNamingError>>
Implementors
impl<TInner: ?Sized> TunnelRegistry for SerializedTunnelRegistry<TInner> where
TInner: TunnelRegistry + Send + Sync,