pub(crate) trait AbstractChannelFactory {
type Channel: AbstractChannel;
type BuildSpec: HasRelayIds;
type Stream;
// Required methods
fn build_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 Self::BuildSpec,
reporter: BootstrapReporter,
memquota: ChannelAccount,
) -> Pin<Box<dyn Future<Output = Result<Arc<Self::Channel>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn build_channel_using_incoming<'life0, 'async_trait>(
&'life0 self,
peer: SocketAddr,
stream: Self::Stream,
memquota: ChannelAccount,
) -> Pin<Box<dyn Future<Output = Result<Arc<Self::Channel>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Trait to describe how channels-like objects are created.
This differs from ChannelFactory
in that
it’s a purely crate-internal type that we use to decouple the
AbstractChanMgr code from actual “what is a channel” concerns.
Required Associated Types§
Sourcetype Channel: AbstractChannel
type Channel: AbstractChannel
The type of channel that this factory can build.
Required Methods§
Sourcefn build_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 Self::BuildSpec,
reporter: BootstrapReporter,
memquota: ChannelAccount,
) -> Pin<Box<dyn Future<Output = Result<Arc<Self::Channel>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn build_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 Self::BuildSpec,
reporter: BootstrapReporter,
memquota: ChannelAccount,
) -> Pin<Box<dyn Future<Output = Result<Arc<Self::Channel>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Construct a new channel to the destination described at target
.
This function must take care of all timeouts, error detection, and so on.
It should not retry; that is handled at a higher level.
Sourcefn build_channel_using_incoming<'life0, 'async_trait>(
&'life0 self,
peer: SocketAddr,
stream: Self::Stream,
memquota: ChannelAccount,
) -> Pin<Box<dyn Future<Output = Result<Arc<Self::Channel>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Available on crate feature relay
only.
fn build_channel_using_incoming<'life0, 'async_trait>(
&'life0 self,
peer: SocketAddr,
stream: Self::Stream,
memquota: ChannelAccount,
) -> Pin<Box<dyn Future<Output = Result<Arc<Self::Channel>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
relay
only.Construct a new channel for an incoming connection.