pub trait ChannelFactory: Send + Sync {
// Required method
fn connect_via_transport<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 OwnedChanTarget,
reporter: BootstrapReporter,
memquota: ChannelAccount,
) -> Pin<Box<dyn Future<Output = Result<Arc<Channel>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
An object that knows how to build Channels
to ChanTarget
s.
This trait must be object-safe.
Every ChanMgr
has a ChannelFactory
that it uses to
construct all of its channels.
A ChannelFactory
can be implemented in terms of a
TransportImplHelper
, by wrapping it in a
ChanBuilder
.
(In fact, as of the time of writing, this is the only way to implement this trait
outside of this crate while keeping bootstrap status reporting, since BootstrapReporter
is an opaque type.)
Required Methods§
Sourcefn connect_via_transport<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 OwnedChanTarget,
reporter: BootstrapReporter,
memquota: ChannelAccount,
) -> Pin<Box<dyn Future<Output = Result<Arc<Channel>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn connect_via_transport<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 OwnedChanTarget,
reporter: BootstrapReporter,
memquota: ChannelAccount,
) -> Pin<Box<dyn Future<Output = Result<Arc<Channel>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Open an authenticated channel to target
.
This method does does not necessarily handle retries or timeouts, although some of its implementations may.
This method does not necessarily handle every kind of transport. If the
caller provides a target with an unsupported
TransportId
, this method should return
Error::NoSuchTransport
.