Skip to main content

NfsCompoundClient

Struct NfsCompoundClient 

Source
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

Source

pub fn connect(info: &NfsBypassInfo) -> Result<Self, NfsError>

Connect to the NFS server and establish a session.

Performs TCP connect -> EXCHANGE_ID -> CREATE_SESSION.

Source

pub fn recover_session(&mut self) -> Result<(), NfsError>

Re-establish session after NFS4ERR_BADSESSION or connection loss.

Source

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.

Source

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).

Source

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.

Source

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.

Source

pub fn invalidate_handle(&self, dir_path: &Path)

Invalidate a cached directory handle.

Source

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).

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more