Skip to main content

NinePClient

Struct NinePClient 

Source
pub struct NinePClient { /* private fields */ }

Implementations§

Source§

impl NinePClient

Source

pub async fn open_clone( &self, from: u32, newfid: u32, flags: u32, fallback_flags: Option<u32>, ) -> ClientResult<(Qid, u32)>

Opens from on newfid. On error, fallback_flags permits one retry. The caller owns newfid.

Source

pub async fn open_clone_prefetch( &self, from: u32, newfid: u32, flags: u32, prefetch: u32, ) -> ClientResult<(Qid, u32, Option<Bytes>)>

Opens from on newfid and optionally prefetches from offset zero. Returns data only when the prefetch reaches EOF. The caller owns newfid.

Source§

impl NinePClient

Source

pub async fn connect_tcp( addr: SocketAddr, requested_msize: u32, ) -> Result<Arc<Self>>

Connect to a 9P server over TCP and negotiate the protocol version.

Source

pub async fn connect_unix( path: impl AsRef<Path>, requested_msize: u32, ) -> Result<Arc<Self>>

Connect to a 9P server over a Unix domain socket and negotiate the version.

Source

pub async fn connect_multi( targets: Vec<Target>, requested_msize: u32, ) -> Result<Arc<Self>>

Connect to the serving leader in a target set and re-probe on reconnect.

Source

pub fn msize(&self) -> u32

The message size negotiated for the logical session.

Source

pub fn is_connected(&self) -> bool

Whether requests currently have a live connection rather than waiting for reconnect/session replay.

Source

pub fn traffic_stats(&self) -> TrafficStats

Cumulative traffic across the lifetime of this logical client.

Source

pub fn max_io(&self) -> u32

Maximum data a single Tread/Treaddir response (Rread/Rreaddir) can carry within the negotiated msize: msize - header - count.

Source

pub fn max_write_payload(&self) -> u32

Maximum data a single Twrite request can carry within the negotiated msize. The Twrite header is larger than the Rread header, so this is smaller than Self::max_io; using max_io here would produce a frame a few bytes over msize that the server rejects.

Source

pub fn alloc_fid(&self) -> u32

Allocate a fresh fid (reusing a freed one when possible).

Source

pub fn free_fid(&self, fid: u32)

Return a fid to the free list. The caller must have clunked it already.

Source

pub fn outstanding_fids(&self) -> usize

Allocated fids not yet returned to the free list. Leak-accounting diagnostic.

Source

pub async fn attach( &self, fid: u32, afid: u32, uname: &str, aname: &str, n_uname: u32, ) -> ClientResult<Qid>

Source

pub async fn rebind( &self, fid: u32, inode_id: u64, n_uname: u32, ) -> ClientResult<Qid>

Bind fid to an inode by id (no path walk), acting as n_uname. Used for per-user fids and reconnect replay.

Source

pub async fn walk( &self, fid: u32, newfid: u32, names: &[&[u8]], ) -> ClientResult<Vec<Qid>>

Source

pub async fn walk_getattr( &self, fid: u32, newfid: u32, names: &[&[u8]], ) -> ClientResult<(Vec<Qid>, Stat)>

Full walk plus the final stat in one round trip. Records newfid like Self::walk.

Source

pub async fn clunk(&self, fid: u32) -> ClientResult<()>

Source

pub async fn getattr(&self, fid: u32, mask: u64) -> ClientResult<Stat>

Source

pub async fn setattr(&self, ts: Tsetattr) -> ClientResult<()>

Source

pub async fn fallocate( &self, fid: u32, offset: u64, length: u64, mode: u32, ) -> ClientResult<()>

Atomically allocate, punch, or zero a file range through the negotiated ZeroFS-private Tfallocate request.

Source

pub async fn setattr_attr(&self, ts: Tsetattr) -> ClientResult<Stat>

Like Self::setattr but the reply carries the post-op stat.

Source

pub async fn lopen(&self, fid: u32, flags: u32) -> ClientResult<(Qid, u32)>

Source

pub async fn lopenat( &self, fid: u32, newfid: u32, flags: u32, ) -> ClientResult<(Qid, u32)>

Open fid’s inode on a fresh newfid in one round trip; fid is untouched.

Source

pub async fn lopenatread( &self, fid: u32, newfid: u32, flags: u32, count: u32, ) -> ClientResult<(Qid, u32, Bytes, bool)>

Open fid’s inode on newfid like Self::lopenat and prefetch up to count bytes from offset 0 in the same round trip. Returns the qid, the iounit, the prefetched bytes, and whether they reach EOF (the whole file fit in count). The inline read is best-effort: a server-side read error yields empty data with eof = false, and the open still succeeds.

Source

pub async fn lcreate( &self, fid: u32, name: &[u8], flags: u32, mode: u32, gid: u32, ) -> ClientResult<(Qid, u32)>

Source

pub async fn lcreateattr( &self, dfid: u32, newfid: u32, name: &[u8], flags: u32, mode: u32, gid: u32, ) -> ClientResult<(Stat, u32)>

Create and open name under dfid, returning the post-op stat in one round trip (Tlcreateattr). Unlike Self::lcreate, dfid is left untouched (the file opens on newfid).

Source

pub async fn read( &self, fid: u32, offset: u64, size: u32, ) -> ClientResult<Vec<u8>>

Read up to size bytes at offset, looping over multiple Tread requests when size exceeds the negotiated msize. Stops early on a short read (EOF).

Source

pub async fn read_bytes( &self, fid: u32, offset: u64, size: u32, ) -> ClientResult<Bytes>

Like Self::read but returns the payload as Bytes. The Rread payload already arrives as Bytes, so a single-round-trip read returns it with no copy; only a multi-chunk read concatenates.

Source

pub async fn write( &self, fid: u32, offset: u64, data: &[u8], ) -> ClientResult<u64>

Write all of data at offset, splitting into multiple Twrite requests when it exceeds the negotiated msize. Returns the total bytes written.

Source

pub async fn readdir( &self, fid: u32, offset: u64, count: u32, ) -> ClientResult<Vec<DirEntry>>

Source

pub async fn readdirplus( &self, fid: u32, offset: u64, count: u32, ) -> ClientResult<Vec<DirEntryPlus>>

Like Self::readdir but each entry carries its full stat (Treaddirattr).

Source

pub async fn mkdir( &self, dfid: u32, name: &[u8], mode: u32, gid: u32, ) -> ClientResult<Qid>

Source

pub async fn mkdir_attr( &self, dfid: u32, name: &[u8], mode: u32, gid: u32, ) -> ClientResult<Stat>

Like Self::mkdir but the reply carries the new directory’s full stat.

Like Self::symlink but the reply carries the new link’s full stat.

Source

pub async fn mknod( &self, dfid: u32, name: &[u8], mode: u32, major: u32, minor: u32, gid: u32, ) -> ClientResult<Qid>

Source

pub async fn mknod_attr( &self, dfid: u32, name: &[u8], mode: u32, major: u32, minor: u32, gid: u32, ) -> ClientResult<Stat>

Like Self::mknod but the reply carries the new node’s full stat.

Like Self::link but the reply carries the linked inode’s post-op stat (updated nlink).

Source

pub async fn renameat( &self, olddirfid: u32, oldname: &[u8], newdirfid: u32, newname: &[u8], ) -> ClientResult<()>

Source

pub async fn unlinkat( &self, dirfid: u32, name: &[u8], flags: u32, ) -> ClientResult<()>

Source

pub async fn fsync_inode( &self, fids: &[u32], primary: u32, datasync: u32, ) -> ClientResult<()>

Verifies fsync for all fids associated with one inode. primary carries Tfsyncdur; the oldest recorded lineage token determines the result.

Source

pub async fn fsync(&self, fid: u32, datasync: u32) -> ClientResult<()>

Verified fsync for one fid. Multi-fid inode users call Self::fsync_inode.

Source

pub async fn fsync_all(&self, primary: u32, datasync: u32) -> ClientResult<()>

Filesystem-wide barrier for this client’s outstanding durability obligations.

Source

pub async fn statfs(&self, fid: u32) -> ClientResult<Rstatfs>

Source

pub async fn lock( &self, fid: u32, lock_type: LockType, flags: u32, start: u64, length: u64, proc_id: u32, client_id: &[u8], ) -> ClientResult<LockStatus>

Acquire or release a POSIX record lock. Returns the lock status; note that a non-blocking conflict surfaces as Err(ClientError::Errno(EAGAIN)) (the server replies Rlerror), whereas a blocking request that cannot be granted returns Ok(LockStatus::Blocked).

Source

pub async fn getlock( &self, fid: u32, lock_type: LockType, start: u64, length: u64, proc_id: u32, client_id: &[u8], ) -> ClientResult<Rgetlock>

Test for a conflicting POSIX record lock.

Trait Implementations§

Source§

impl Drop for NinePClient

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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