Skip to main content

Channel

Struct Channel 

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

A safe RDMA communication endpoint built on top of a QueuePair.

Channel wraps a queue pair with lifetime-safe operation posting through scope and manual_scope.

A channel belongs to a ProtectionDomain and can share memory regions with other channels under the same domain. Use ProtectionDomain::create_channel or Channel::builder to construct one.

Implementations§

Source§

impl Channel

Source

pub fn builder<'f1>() -> ChannelBuilder<'f1>

Source§

impl Channel

Source

pub fn send<'op>( &'op mut self, wr: SendWorkRequest<'op, 'op>, ) -> TransportResult<WorkSuccess>

Posts a send operation and blocks until it completes.

Source

pub fn receive<'op>( &'op mut self, wr: ReceiveWorkRequest<'op, 'op>, ) -> TransportResult<WorkSuccess>

Posts a receive operation and blocks until it completes.

Source

pub fn write<'op>( &'op mut self, wr: WriteWorkRequest<'op, 'op>, ) -> TransportResult<WorkSuccess>

Posts an RDMA write operation and blocks until it completes.

Source

pub fn read<'op>( &'op mut self, wr: ReadWorkRequest<'op, 'op>, ) -> TransportResult<WorkSuccess>

Posts an RDMA read operation and blocks until it completes.

Source§

impl Channel

Source

pub unsafe fn send_unpolled<'data>( &mut self, wr: SendWorkRequest<'_, 'data>, ) -> IbvResult<PendingWork<'data>>

Posts a send operation without polling for completion.

§Safety

The returned PendingWork must not be leaked (e.g. via mem::forget), as this would end the borrow without dropping while the hardware may still access the memory. Prefer scope or manual_scope which prevent this.

Source

pub unsafe fn receive_unpolled<'data>( &mut self, wr: ReceiveWorkRequest<'_, 'data>, ) -> IbvResult<PendingWork<'data>>

Posts a receive operation without polling for completion.

§Safety

The returned PendingWork must not be leaked (e.g. via mem::forget), as this would end the borrow without dropping while the hardware may still access the memory. Prefer scope or manual_scope which prevent this.

Source

pub unsafe fn write_unpolled<'data>( &mut self, wr: WriteWorkRequest<'_, 'data>, ) -> IbvResult<PendingWork<'data>>

Posts an RDMA write operation without polling for completion.

§Safety

The returned PendingWork must not be leaked (e.g. via mem::forget), as this would end the borrow without dropping while the hardware may still access the memory. Prefer scope or manual_scope which prevent this.

Source

pub unsafe fn read_unpolled<'data>( &mut self, wr: ReadWorkRequest<'_, 'data>, ) -> IbvResult<PendingWork<'data>>

Posts an RDMA read operation without polling for completion.

§Safety

The returned PendingWork must not be leaked (e.g. via mem::forget), as this would end the borrow without dropping while the hardware may still access the memory. Prefer scope or manual_scope which prevent this.

Source§

impl Channel

Source

pub fn scope<'env, F, T, E>(&'env mut self, f: F) -> Result<T, ScopeError<E>>
where F: for<'scope> FnOnce(&mut PollingScope<'scope, 'env, Channel>) -> Result<T, E>,

Opens a polling scope that automatically polls all outstanding work requests when it ends.

This is the primary safe way to perform RDMA operations. The closure receives a PollingScope through which operations can be posted. When the closure returns, any work requests that were not manually polled are automatically polled to completion before this method returns.

See manual_scope for a variant that enforces manual polling and returns the user’s error type directly.

§Error handling
  • If the closure returns Err(E), the scope still auto-polls all outstanding work, then returns ScopeError::ClosureError(E).
  • If the closure returns Ok(T) but auto-polling encounters transport errors, returns ScopeError::AutoPollError(...).
  • If the closure panics, outstanding work is still polled for cleanup before the panic is resumed.
Source

pub fn manual_scope<'env, F, T, E>(&'env mut self, f: F) -> Result<T, E>
where F: for<'scope> FnOnce(&mut PollingScope<'scope, 'env, Channel>) -> Result<T, E>,

Opens a polling scope that enforces manual polling of all work requests.

Both scope and manual_scope allow the user to poll work manually. The difference is that manual_scope makes this the contract: it returns Result<T, E> directly instead of wrapping it in ScopeError, avoiding unnecessary error handling. If the closure succeeds but leaves work unpolled, this method panics as a safety net.

If the closure returns an error, outstanding work is still cleaned up without panicking.

Source§

impl Channel

Source

pub fn pd(&self) -> &ProtectionDomain

Returns a reference to the channel’s ProtectionDomain.

Trait Implementations§

Source§

impl Debug for Channel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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