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
impl Channel
Sourcepub fn send<'op>(
&'op mut self,
wr: SendWorkRequest<'op, 'op>,
) -> TransportResult<WorkSuccess>
pub fn send<'op>( &'op mut self, wr: SendWorkRequest<'op, 'op>, ) -> TransportResult<WorkSuccess>
Posts a send operation and blocks until it completes.
Sourcepub fn receive<'op>(
&'op mut self,
wr: ReceiveWorkRequest<'op, 'op>,
) -> TransportResult<WorkSuccess>
pub fn receive<'op>( &'op mut self, wr: ReceiveWorkRequest<'op, 'op>, ) -> TransportResult<WorkSuccess>
Posts a receive operation and blocks until it completes.
Sourcepub fn write<'op>(
&'op mut self,
wr: WriteWorkRequest<'op, 'op>,
) -> TransportResult<WorkSuccess>
pub fn write<'op>( &'op mut self, wr: WriteWorkRequest<'op, 'op>, ) -> TransportResult<WorkSuccess>
Posts an RDMA write operation and blocks until it completes.
Sourcepub fn read<'op>(
&'op mut self,
wr: ReadWorkRequest<'op, 'op>,
) -> TransportResult<WorkSuccess>
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
impl Channel
Sourcepub unsafe fn send_unpolled<'data>(
&mut self,
wr: SendWorkRequest<'_, 'data>,
) -> IbvResult<PendingWork<'data>>
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.
Sourcepub unsafe fn receive_unpolled<'data>(
&mut self,
wr: ReceiveWorkRequest<'_, 'data>,
) -> IbvResult<PendingWork<'data>>
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.
Sourcepub unsafe fn write_unpolled<'data>(
&mut self,
wr: WriteWorkRequest<'_, 'data>,
) -> IbvResult<PendingWork<'data>>
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.
Sourcepub unsafe fn read_unpolled<'data>(
&mut self,
wr: ReadWorkRequest<'_, 'data>,
) -> IbvResult<PendingWork<'data>>
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
impl Channel
Sourcepub fn scope<'env, F, T, E>(&'env mut self, f: F) -> Result<T, ScopeError<E>>
pub fn scope<'env, F, T, E>(&'env mut self, f: F) -> Result<T, ScopeError<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 returnsScopeError::ClosureError(E). - If the closure returns
Ok(T)but auto-polling encounters transport errors, returnsScopeError::AutoPollError(...). - If the closure panics, outstanding work is still polled for cleanup before the panic is resumed.
Sourcepub fn manual_scope<'env, F, T, E>(&'env mut self, f: F) -> Result<T, E>
pub fn manual_scope<'env, F, T, E>(&'env mut self, f: F) -> 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
impl Channel
Sourcepub fn pd(&self) -> &ProtectionDomain
pub fn pd(&self) -> &ProtectionDomain
Returns a reference to the channel’s ProtectionDomain.