Skip to main content

ibverbs_rs/channel/ops/
polled_ops.rs

1use crate::channel::{Channel, TransportResult};
2use crate::ibverbs::work::{
3    ReadWorkRequest, ReceiveWorkRequest, SendWorkRequest, WorkSuccess, WriteWorkRequest,
4};
5
6impl Channel {
7    /// Posts a send operation and blocks until it completes.
8    pub fn send<'op>(&'op mut self, wr: SendWorkRequest<'op, 'op>) -> TransportResult<WorkSuccess> {
9        self.manual_scope(|s| s.post_send(wr)?.spin_poll())
10    }
11
12    /// Posts a receive operation and blocks until it completes.
13    pub fn receive<'op>(
14        &'op mut self,
15        wr: ReceiveWorkRequest<'op, 'op>,
16    ) -> TransportResult<WorkSuccess> {
17        self.manual_scope(|s| s.post_receive(wr)?.spin_poll())
18    }
19
20    /// Posts an RDMA write operation and blocks until it completes.
21    pub fn write<'op>(
22        &'op mut self,
23        wr: WriteWorkRequest<'op, 'op>,
24    ) -> TransportResult<WorkSuccess> {
25        self.manual_scope(|s| s.post_write(wr)?.spin_poll())
26    }
27
28    /// Posts an RDMA read operation and blocks until it completes.
29    pub fn read<'op>(&'op mut self, wr: ReadWorkRequest<'op, 'op>) -> TransportResult<WorkSuccess> {
30        self.manual_scope(|s| s.post_read(wr)?.spin_poll())
31    }
32}