Struct async_rdma::RdmaBuilder
source · [−]pub struct RdmaBuilder { /* private fields */ }
Expand description
The builder for the Rdma
, it follows the builder pattern.
Implementations
sourceimpl RdmaBuilder
impl RdmaBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Create a default builder
The default settings are:
dev name: None
access right: LocalWrite
| RemoteRead
| RemoteWrite
| RemoteAtomic
complete queue size: 16
port number: 1
gid index: 1
Note: We highly recommend setting the port number and the gid index.
sourcepub async fn connect<A: ToSocketAddrs>(self, addr: A) -> Result<Rdma>
pub async fn connect<A: ToSocketAddrs>(self, addr: A) -> Result<Rdma>
Establish connection with RDMA server
Used with listen
Examples
use async_rdma::RdmaBuilder;
use portpicker::pick_unused_port;
use std::{
io,
net::{Ipv4Addr, SocketAddrV4},
time::Duration,
};
async fn client(addr: SocketAddrV4) -> io::Result<()> {
let _rdma = RdmaBuilder::default().connect(addr).await?;
Ok(())
}
#[tokio::main]
async fn server(addr: SocketAddrV4) -> io::Result<()> {
let _rdma = RdmaBuilder::default().listen(addr).await?;
Ok(())
}
#[tokio::main]
async fn main() {
let addr = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), pick_unused_port().unwrap());
std::thread::spawn(move || server(addr));
tokio::time::sleep(Duration::from_secs(3)).await;
client(addr)
.await
.map_err(|err| println!("{}", err))
.unwrap();
}
sourcepub async fn listen<A: ToSocketAddrs>(self, addr: A) -> Result<Rdma>
pub async fn listen<A: ToSocketAddrs>(self, addr: A) -> Result<Rdma>
Listen to the address to wait for a connection to be established
Used with connect
Examples
use async_rdma::RdmaBuilder;
use portpicker::pick_unused_port;
use std::{
io,
net::{Ipv4Addr, SocketAddrV4},
time::Duration,
};
async fn client(addr: SocketAddrV4) -> io::Result<()> {
let _rdma = RdmaBuilder::default().connect(addr).await?;
Ok(())
}
#[tokio::main]
async fn server(addr: SocketAddrV4) -> io::Result<()> {
let _rdma = RdmaBuilder::default().listen(addr).await?;
Ok(())
}
#[tokio::main]
async fn main() {
let addr = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), pick_unused_port().unwrap());
std::thread::spawn(move || server(addr));
tokio::time::sleep(Duration::from_secs(3)).await;
client(addr)
.await
.map_err(|err| println!("{}", err))
.unwrap();
}
sourcepub fn set_cq_size(self, cq_size: u32) -> Self
pub fn set_cq_size(self, cq_size: u32) -> Self
Set the complete queue size
sourcepub fn set_gid_index(self, gid_index: usize) -> Self
pub fn set_gid_index(self, gid_index: usize) -> Self
Set the gid index
sourcepub fn set_port_num(self, port_num: u8) -> Self
pub fn set_port_num(self, port_num: u8) -> Self
Set the port number
sourcepub fn set_conn_type(self, conn_type: ConnectionType) -> Self
pub fn set_conn_type(self, conn_type: ConnectionType) -> Self
Set the connection type
sourcepub fn set_qp_max_send_wr(self, max_send_wr: u32) -> Self
pub fn set_qp_max_send_wr(self, max_send_wr: u32) -> Self
Set maximum number of outstanding send requests in the send queue
sourcepub fn set_qp_max_recv_wr(self, max_recv_wr: u32) -> Self
pub fn set_qp_max_recv_wr(self, max_recv_wr: u32) -> Self
Set maximum number of outstanding receive requests in the receive queue
sourcepub fn set_qp_max_send_sge(self, max_send_sge: u32) -> Self
pub fn set_qp_max_send_sge(self, max_send_sge: u32) -> Self
Set maximum number of scatter/gather elements (SGE) in a WR on the send queue
sourcepub fn set_qp_max_recv_sge(self, max_recv_sge: u32) -> Self
pub fn set_qp_max_recv_sge(self, max_recv_sge: u32) -> Self
Set maximum number of scatter/gather elements (SGE) in a WR on the receive queue
sourcepub fn set_qp_access(self, flags: BitFlags<AccessFlag>) -> Self
pub fn set_qp_access(self, flags: BitFlags<AccessFlag>) -> Self
Set default QP
access
sourcepub fn set_mr_access(self, flags: BitFlags<AccessFlag>) -> Self
pub fn set_mr_access(self, flags: BitFlags<AccessFlag>) -> Self
Set default MR
access
sourcepub fn set_mr_strategy(self, strategy: MRManageStrategy) -> Self
pub fn set_mr_strategy(self, strategy: MRManageStrategy) -> Self
Set the stragety to manage MR
s
sourcepub fn set_max_message_length(self, max_msg_len: usize) -> Self
pub fn set_max_message_length(self, max_msg_len: usize) -> Self
Set max length of message send/recv by Agent
sourcepub fn set_max_rmr_access(self, flags: BitFlags<AccessFlag>) -> Self
pub fn set_max_rmr_access(self, flags: BitFlags<AccessFlag>) -> Self
Set max access permission for remote mr requests
Trait Implementations
sourceimpl Debug for RdmaBuilder
impl Debug for RdmaBuilder
sourceimpl Default for RdmaBuilder
impl Default for RdmaBuilder
sourcefn default() -> RdmaBuilder
fn default() -> RdmaBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for RdmaBuilder
impl Send for RdmaBuilder
impl Sync for RdmaBuilder
impl Unpin for RdmaBuilder
impl UnwindSafe for RdmaBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more