pub struct NfsCompoundClient { /* private fields */ }Expand description
NFSv4.2 compound RPC client over TCP.
Sends file creation compounds directly to the NFS server, bypassing VFS. One TCP connection, one session, sequential slot usage.
Implementations§
Source§impl NfsCompoundClient
impl NfsCompoundClient
Sourcepub fn connect(info: &NfsBypassInfo) -> Result<Self, NfsError>
pub fn connect(info: &NfsBypassInfo) -> Result<Self, NfsError>
Connect to the NFS server and establish a session.
Performs TCP connect -> EXCHANGE_ID -> CREATE_SESSION.
Sourcepub fn recover_session(&mut self) -> Result<(), NfsError>
pub fn recover_session(&mut self) -> Result<(), NfsError>
Re-establish session after NFS4ERR_BADSESSION or connection loss.
Sourcepub fn ensure_gss_valid(&mut self)
pub fn ensure_gss_valid(&mut self)
Refresh the GSS context if it is expired or near expiry. No-op when the krb5 feature is disabled or no GSS context is active.
Sourcepub fn write_file(
&mut self,
parent_handle: &[u8],
filename: &str,
data: &[u8],
mode: u32,
uid: u32,
gid: u32,
mtime: (i64, i64),
) -> Result<(), NfsError>
pub fn write_file( &mut self, parent_handle: &[u8], filename: &str, data: &[u8], mode: u32, uid: u32, gid: u32, mtime: (i64, i64), ) -> Result<(), NfsError>
Write a single file to the NFS server via compound RPC.
SEQUENCE + PUTFH(parent) + OPEN(create) + WRITE(FILE_SYNC) + CLOSE Retries on NFS4ERR_GRACE (server grace period after session creation).
Sourcepub fn write_files_compound(
&mut self,
parent_handle: &[u8],
files: &[(&str, &[u8], u32, u32, u32, (i64, i64))],
) -> Result<Vec<Result<(), NfsError>>, NfsError>
pub fn write_files_compound( &mut self, parent_handle: &[u8], files: &[(&str, &[u8], u32, u32, u32, (i64, i64))], ) -> Result<Vec<Result<(), NfsError>>, NfsError>
Write multiple files to the NFS server in a single compound RPC.
Builds: SEQUENCE + PUTFH(parent) + [OPEN+WRITE+CLOSE]xN
Returns Vec<Result<(), NfsError>> – per-file results for partial failure handling.
Max 4 files per compound (SEQUENCE + PUTFH + 4x(OPEN+WRITE+CLOSE) = 14 ops,
within ca_maxoperations=16 negotiated in CREATE_SESSION). Larger batches are
automatically split into multiple compounds.
Sourcepub fn get_or_resolve_handle(
&mut self,
dir_path: &Path,
) -> Result<Vec<u8>, NfsError>
pub fn get_or_resolve_handle( &mut self, dir_path: &Path, ) -> Result<Vec<u8>, NfsError>
Get or resolve the NFS file handle for a directory path.
Uses PUTROOTFH + LOOKUP compounds to walk from the export root to the target directory, caching intermediate handles.
Sourcepub fn invalidate_handle(&self, dir_path: &Path)
pub fn invalidate_handle(&self, dir_path: &Path)
Invalidate a cached directory handle.
Sourcepub fn batch_stat(
&mut self,
dir_handle: &[u8],
filenames: &[&str],
) -> Result<Vec<(String, u64, i64, i64)>, NfsError>
pub fn batch_stat( &mut self, dir_handle: &[u8], filenames: &[&str], ) -> Result<Vec<(String, u64, i64, i64)>, NfsError>
Batch-fetch size+mtime for multiple files in a directory.
Sends a single compound: SEQUENCE + PUTFH(dir) + [LOOKUP(file) + GETATTR]xN Returns (filename, size, mtime_sec, mtime_nsec) for each file found. Files that don’t exist (LOOKUP returns NFS4ERR_NOENT) are silently skipped. Max 7 files per compound (SEQUENCE + PUTFH + 7x(LOOKUP+GETATTR) = 16 ops).
Sourcepub fn batch_read_head(
&mut self,
dir_handle: &[u8],
filenames: &[&str],
read_bytes: usize,
) -> Result<Vec<(String, Vec<u8>)>, NfsError>
pub fn batch_read_head( &mut self, dir_handle: &[u8], filenames: &[&str], read_bytes: usize, ) -> Result<Vec<(String, Vec<u8>)>, NfsError>
Batch-read the first read_bytes of multiple files in a single compound RPC.
Compound structure: SEQUENCE + PUTFH(dir) + [LOOKUP(name) + READ(offset=0, count=read_bytes)] × N Uses the anonymous stateid (seqid=0, other=all-zeros) — no OPEN/CLOSE needed. Files where LOOKUP returns NFS4ERR_NOENT are silently skipped.
Returns: Vec of (filename, head_bytes) for files that were successfully read.
Auto Trait Implementations§
impl !Freeze for NfsCompoundClient
impl !RefUnwindSafe for NfsCompoundClient
impl Send for NfsCompoundClient
impl Sync for NfsCompoundClient
impl Unpin for NfsCompoundClient
impl UnsafeUnpin for NfsCompoundClient
impl UnwindSafe for NfsCompoundClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more