Struct NetTransport

Source
pub struct NetTransport<I, A, S, R>
where I: Id, A: AddressResolver<ResolvedAddress = SocketAddr, Runtime = R>, S: StreamLayer<Runtime = R>, R: Runtime,
{ /* private fields */ }
Expand description

The net transport based on TCP/TLS and UDP

Trait Implementations§

Source§

impl<I, A, S, R> Drop for NetTransport<I, A, S, R>
where I: Id, A: AddressResolver<ResolvedAddress = SocketAddr, Runtime = R>, S: StreamLayer<Runtime = R>, R: Runtime,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<I, A, S, R> Transport for NetTransport<I, A, S, R>
where I: Id + Data + Send + Sync + 'static, A: AddressResolver<ResolvedAddress = SocketAddr, Runtime = R>, A::Address: Data + Send + Sync + 'static, S: StreamLayer<Runtime = R>, R: Runtime,

Source§

type Error = NetTransportError<<NetTransport<I, A, S, R> as Transport>::Resolver>

The error type for the transport
Source§

type Id = I

The id type used to identify nodes
Source§

type Address = <A as AddressResolver>::Address

The address type of the node
Source§

type ResolvedAddress = SocketAddr

The resolved address type of the node
Source§

type Resolver = A

The address resolver used to resolve addresses
Source§

type Connection = <S as StreamLayer>::Stream

The promised connection used to send and receive messages
Source§

type Runtime = <<NetTransport<I, A, S, R> as Transport>::Resolver as AddressResolver>::Runtime

The async runtime
Source§

type Options = NetTransportOptions<<NetTransport<I, A, S, R> as Transport>::Id, <NetTransport<I, A, S, R> as Transport>::Resolver, S>

The options used to construct the transport
Source§

async fn new(transport_opts: Self::Options) -> Result<Self, Self::Error>

Creates a new transport with the given options
Source§

async fn resolve( &self, addr: &<Self::Resolver as AddressResolver>::Address, ) -> Result<<Self::Resolver as AddressResolver>::ResolvedAddress, Self::Error>

Resolves the given address to a resolved address
Source§

fn local_id(&self) -> &Self::Id

Returns the local id of the node
Source§

fn local_address(&self) -> &<Self::Resolver as AddressResolver>::Address

Returns the local address of the node
Source§

fn advertise_address( &self, ) -> &<Self::Resolver as AddressResolver>::ResolvedAddress

Returns the advertise address of the node
Source§

fn max_packet_size(&self) -> usize

Returns the maximum size of a packet that can be sent
Source§

fn header_overhead(&self) -> usize

Returns the header overhead in bytes this transport.
Source§

fn blocked_address( &self, addr: &<Self::Resolver as AddressResolver>::ResolvedAddress, ) -> Result<(), Self::Error>

Returns an error if the given address is blocked
Source§

async fn send_to( &self, addr: &<Self::Resolver as AddressResolver>::ResolvedAddress, packets: Payload, ) -> Result<(usize, <Self::Runtime as RuntimeLite>::Instant), Self::Error>

A packet-oriented interface that fires off the given payload to the given address in a connectionless fashion. Read more
Source§

async fn open( &self, addr: &<Self::Resolver as AddressResolver>::ResolvedAddress, deadline: <Self::Runtime as RuntimeLite>::Instant, ) -> Result<Self::Connection, Self::Error>

Used to create a bidirection connection that allows us to perform two-way communication with a peer. This is generally more expensive than packet connections so is used for more infrequent operations such as anti-entropy or fallback probes if the packet-oriented probe failed.
Source§

fn packet( &self, ) -> PacketSubscriber<<Self::Resolver as AddressResolver>::ResolvedAddress, <Self::Runtime as RuntimeLite>::Instant>

Returns a packet subscriber that can be used to receive incoming packets
Source§

fn stream( &self, ) -> StreamSubscriber<<Self::Resolver as AddressResolver>::ResolvedAddress, Self::Connection>

Returns a receiver that can be read to handle incoming stream connections from other peers. How this is set up for listening is left as an exercise for the concrete transport implementations.
Source§

fn packet_reliable(&self) -> bool

Returns true if the transport provides provides reliable packets delivery. Read more
Source§

fn packet_secure(&self) -> bool

Returns true if the transport provides packets security. Read more
Source§

fn stream_secure(&self) -> bool

Returns true if the transport provides stream security. Read more
Source§

async fn shutdown(&self) -> Result<(), Self::Error>

Shutdown the transport
Source§

fn read( &self, from: &Self::ResolvedAddress, conn: &mut <Self::Connection as Connection>::Reader, ) -> impl Future<Output = Result<usize, Self::Error>> + Send

This is a hook that allows the transport to perform any extra work when the memberlist accepts a new connection from a remote node. Read more
Source§

fn write( &self, conn: &mut <Self::Connection as Connection>::Writer, payload: Payload, ) -> impl Future<Output = Result<usize, Self::Error>> + Send

Sends a message to the remote node by promised connection. Read more

Auto Trait Implementations§

§

impl<I, A, S, R> !Freeze for NetTransport<I, A, S, R>

§

impl<I, A, S, R> !RefUnwindSafe for NetTransport<I, A, S, R>

§

impl<I, A, S, R> Send for NetTransport<I, A, S, R>
where <A as AddressResolver>::Address: Send + Sync, I: Sync + Send,

§

impl<I, A, S, R> Sync for NetTransport<I, A, S, R>
where <A as AddressResolver>::Address: Sync + Send, I: Sync + Send,

§

impl<I, A, S, R> !Unpin for NetTransport<I, A, S, R>

§

impl<I, A, S, R> !UnwindSafe for NetTransport<I, A, S, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,