Trait async_rdma::LocalMrReadAccess
source · [−]pub unsafe trait LocalMrReadAccess: MrAccess + Sealed {
Show 14 methods
fn lkey(&self) -> u32;
fn get_inner(&self) -> &Arc<RwLock<LocalMrInner>>;
fn as_ptr(&self) -> MappedRwLockReadGuard<'_, *const u8> { ... }
fn try_as_ptr(&self) -> Option<MappedRwLockReadGuard<'_, *const u8>> { ... }
fn as_ptr_unchecked(&self) -> *const u8 { ... }
fn as_slice(&self) -> MappedRwLockReadGuard<'_, &[u8]> { ... }
fn try_as_slice(&self) -> Option<MappedRwLockReadGuard<'_, &[u8]>> { ... }
unsafe fn as_slice_unchecked(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
{ ... }
unsafe fn lkey_unchecked(&self) -> u32 { ... }
unsafe fn rkey_unchecked(&self) -> u32 { ... }
fn token_with_timeout(&self, timeout: Duration) -> Option<MrToken> { ... }
unsafe fn token_with_timeout_unchecked(
&self,
timeout: Duration
) -> Option<MrToken> { ... }
fn is_readable(&self) -> bool { ... }
fn read_inner(&self) -> RwLockReadGuard<'_, LocalMrInner> { ... }
}
Expand description
Local memory region trait
Safety
For the fn
s that have not been marked as unsafe
, we should make sure the implementations
meet all safety requirements, for example the memory of mrs should be initialized.
For the unsafe
fn
s, we should make sure no other safety issues have been introduced except
for the issues that have been listed in the Safety
documents of fn
s.
Required Methods
Provided Methods
Get the start pointer until it is readable
If this mr is being used in RDMA ops, the thread may be blocked
sourcefn try_as_ptr(&self) -> Option<MappedRwLockReadGuard<'_, *const u8>>
fn try_as_ptr(&self) -> Option<MappedRwLockReadGuard<'_, *const u8>>
Try to get the start pointer
Return None
if this mr is being used in RDMA ops without blocking thread
sourcefn as_ptr_unchecked(&self) -> *const u8
fn as_ptr_unchecked(&self) -> *const u8
Get the memory region as slice until it is readable
If this mr is being used in RDMA ops, the thread may be blocked
sourcefn try_as_slice(&self) -> Option<MappedRwLockReadGuard<'_, &[u8]>>
fn try_as_slice(&self) -> Option<MappedRwLockReadGuard<'_, &[u8]>>
Try to get the memory region as slice
Return None
if this mr is being used in RDMA ops without blocking thread
Get the memory region as slice without lock
Safety
- Make sure the mr is readable without cancel safety issue.
- The memory of this mr is initialized.
- The total size of this mr of the slice must be no larger than
isize::MAX
.
sourceunsafe fn lkey_unchecked(&self) -> u32
unsafe fn lkey_unchecked(&self) -> u32
Get the local key without lock
Safety
Must ensure that there are no data races, for example:
- The current thread logically owns a guard but that guard has been discarded using
mem::forget
. - The
lkey
of this mr is going to be changed.(It’s not going to happen so far, because variable lkey has not been implemented yet.)
sourceunsafe fn rkey_unchecked(&self) -> u32
unsafe fn rkey_unchecked(&self) -> u32
Get the remote key without lock
Safety
Must ensure that there are no data races, for example:
- The current thread logically owns a guard but that guard has been discarded using
mem::forget
. - The
rkey
of this mr is going to be changed.(It’s not going to happen so far, because variable rkey has not been implemented yet.)
sourcefn token_with_timeout(&self, timeout: Duration) -> Option<MrToken>
fn token_with_timeout(&self, timeout: Duration) -> Option<MrToken>
New a token with specified timeout
sourceunsafe fn token_with_timeout_unchecked(
&self,
timeout: Duration
) -> Option<MrToken>
unsafe fn token_with_timeout_unchecked(
&self,
timeout: Duration
) -> Option<MrToken>
New a token with specified timeout with rkey_unchecked
Safety
Must ensure that there are no data races about rkey
, for example:
- The current thread logically owns a guard but that guard has been discarded using
mem::forget
. - The
rkey
of this mr is going to be changed.(It’s not going to happen so far, because variable rkey has not been implemented yet.)
sourcefn is_readable(&self) -> bool
fn is_readable(&self) -> bool
Is the corresponding RwLocalMrInner
readable?
sourcefn read_inner(&self) -> RwLockReadGuard<'_, LocalMrInner>
fn read_inner(&self) -> RwLockReadGuard<'_, LocalMrInner>
Get read lock of LocalMrInenr