Trait AbstractChannelFactory

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

Source

type Channel: AbstractChannel

The type of channel that this factory can build.

Source

type BuildSpec: HasRelayIds

Type that explains how to build an outgoing channel.

Source

type Stream

The type of byte stream that’s required to build channels for incoming connections.

Required Methods§

Source

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.

Source

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,

Available on crate feature relay only.

Construct a new channel for an incoming connection.

Implementors§