Skip to main content

AsyncCmId

Struct AsyncCmId 

Source
pub struct AsyncCmId { /* private fields */ }
Expand description

An async RDMA CM ID for client-side connections.

Wraps CmId + EventChannel and provides async versions of the CM operations (resolve_addr, resolve_route, connect). Use with AsyncQp for direct async RDMA verb access, or use AsyncRdmaStream for a higher-level TCP-like interface.

§Example

use rdma_io::async_cm::AsyncCmId;

let cm_id = AsyncCmId::connect_to(&"10.0.0.1:9999".parse().unwrap()).await?;

// Access the inner CmId for QP setup, verb operations, etc.
let ctx = cm_id.verbs_context().unwrap();
let pd = cm_id.alloc_pd()?;

Implementations§

Source§

impl AsyncCmId

Source

pub fn new(port_space: PortSpace) -> Result<Self>

Create a new async CM ID on its own event channel.

Source

pub async fn resolve_addr( &self, src: Option<&SocketAddr>, dst: &SocketAddr, timeout_ms: i32, ) -> Result<()>

Resolve the destination address asynchronously.

Source

pub async fn resolve_route(&self, timeout_ms: i32) -> Result<()>

Resolve the route asynchronously.

Source

pub async fn connect(&self, param: &ConnParam) -> Result<()>

Perform the RDMA connect handshake asynchronously.

Source

pub async fn connect_to(addr: &SocketAddr) -> Result<Self>

Full async connect: resolve_addr → resolve_route → connect.

Convenience method that performs all three CM phases.

Source

pub fn cm_id(&self) -> &CmId

Access the inner CmId for QP setup, verb operations, etc.

Source

pub fn event_channel(&self) -> &EventChannel

Access the inner EventChannel.

Source

pub fn verbs_context(&self) -> Option<Arc<Context>>

Get the verbs context (device) associated with this CM ID.

Source

pub fn alloc_pd(&self) -> Result<Arc<ProtectionDomain>>

Allocate a protection domain on this CM ID’s device.

Source

pub fn create_qp_with_cq( &self, pd: &Arc<ProtectionDomain>, init_attr: &QpInitAttr, send_cq: Option<&Arc<CompletionQueue>>, recv_cq: Option<&Arc<CompletionQueue>>, ) -> Result<CmQueuePair>

Create a QP with separate send/recv CQs on this CM ID.

Returns an owned [CmQueuePair] that the caller must keep alive.

Source

pub fn qp_raw(&self) -> *mut ibv_qp

Raw QP pointer (from the cm_id, for low-level use before QP is transferred).

Source

pub fn disconnect(&self) -> Result<()>

Disconnect the connection (fire-and-forget, synchronous).

Source

pub async fn disconnect_async(&self) -> Result<()>

Disconnect and await the DISCONNECTED event from the peer.

This performs a graceful disconnect: sends the disconnect request, then waits for the peer to acknowledge it. Analogous to TCP’s shutdown() + await FIN-ACK.

Source

pub async fn next_event(&self) -> Result<CmEvent>

Await the next CM event on this connection’s event channel.

Returns any event (disconnect, error, etc.). The caller must ack the event via [CmEvent::ack()]. Useful for monitoring connection lifecycle (e.g., detecting peer disconnect via select!).

Source

pub fn into_parts(self) -> (EventChannel, CmId)

Decompose into the inner EventChannel and CmId.

Used when transferring ownership to a higher-level type (e.g., AsyncRdmaStream).

Trait Implementations§

Source§

impl Drop for AsyncCmId

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for AsyncCmId

Auto Trait Implementations§

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, 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<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