pub struct NinePClient { /* private fields */ }Implementations§
Source§impl NinePClient
impl NinePClient
Sourcepub async fn open_clone(
&self,
from: u32,
newfid: u32,
flags: u32,
fallback_flags: Option<u32>,
) -> ClientResult<(Qid, u32)>
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§impl NinePClient
impl NinePClient
Sourcepub async fn connect_tcp(
addr: SocketAddr,
requested_msize: u32,
) -> Result<Arc<Self>>
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.
Sourcepub async fn connect_unix(
path: impl AsRef<Path>,
requested_msize: u32,
) -> Result<Arc<Self>>
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.
Sourcepub async fn connect_multi(
targets: Vec<Target>,
requested_msize: u32,
) -> Result<Arc<Self>>
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.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether requests currently have a live connection rather than waiting for reconnect/session replay.
Sourcepub fn traffic_stats(&self) -> TrafficStats
pub fn traffic_stats(&self) -> TrafficStats
Cumulative traffic across the lifetime of this logical client.
Sourcepub fn max_io(&self) -> u32
pub fn max_io(&self) -> u32
Maximum data a single Tread/Treaddir response (Rread/Rreaddir) can carry
within the negotiated msize: msize - header - count.
Sourcepub fn max_write_payload(&self) -> u32
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.
Sourcepub fn free_fid(&self, fid: u32)
pub fn free_fid(&self, fid: u32)
Return a fid to the free list. The caller must have clunked it already.
Sourcepub fn outstanding_fids(&self) -> usize
pub fn outstanding_fids(&self) -> usize
Allocated fids not yet returned to the free list. Leak-accounting diagnostic.
pub async fn attach( &self, fid: u32, afid: u32, uname: &str, aname: &str, n_uname: u32, ) -> ClientResult<Qid>
Sourcepub async fn rebind(
&self,
fid: u32,
inode_id: u64,
n_uname: u32,
) -> ClientResult<Qid>
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.
pub async fn walk( &self, fid: u32, newfid: u32, names: &[&[u8]], ) -> ClientResult<Vec<Qid>>
Sourcepub async fn walk_getattr(
&self,
fid: u32,
newfid: u32,
names: &[&[u8]],
) -> ClientResult<(Vec<Qid>, Stat)>
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.
pub async fn clunk(&self, fid: u32) -> ClientResult<()>
pub async fn getattr(&self, fid: u32, mask: u64) -> ClientResult<Stat>
pub async fn setattr(&self, ts: Tsetattr) -> ClientResult<()>
Sourcepub async fn fallocate(
&self,
fid: u32,
offset: u64,
length: u64,
mode: u32,
) -> ClientResult<()>
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.
Sourcepub async fn setattr_attr(&self, ts: Tsetattr) -> ClientResult<Stat>
pub async fn setattr_attr(&self, ts: Tsetattr) -> ClientResult<Stat>
Like Self::setattr but the reply carries the post-op stat.
pub async fn lopen(&self, fid: u32, flags: u32) -> ClientResult<(Qid, u32)>
Sourcepub async fn lopenat(
&self,
fid: u32,
newfid: u32,
flags: u32,
) -> ClientResult<(Qid, u32)>
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.
Sourcepub async fn lopenatread(
&self,
fid: u32,
newfid: u32,
flags: u32,
count: u32,
) -> ClientResult<(Qid, u32, Bytes, bool)>
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.
pub async fn lcreate( &self, fid: u32, name: &[u8], flags: u32, mode: u32, gid: u32, ) -> ClientResult<(Qid, u32)>
Sourcepub async fn lcreateattr(
&self,
dfid: u32,
newfid: u32,
name: &[u8],
flags: u32,
mode: u32,
gid: u32,
) -> ClientResult<(Stat, u32)>
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).
Sourcepub async fn read(
&self,
fid: u32,
offset: u64,
size: u32,
) -> ClientResult<Vec<u8>>
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).
Sourcepub async fn read_bytes(
&self,
fid: u32,
offset: u64,
size: u32,
) -> ClientResult<Bytes>
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.
Sourcepub async fn write(
&self,
fid: u32,
offset: u64,
data: &[u8],
) -> ClientResult<u64>
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.
pub async fn readdir( &self, fid: u32, offset: u64, count: u32, ) -> ClientResult<Vec<DirEntry>>
Sourcepub async fn readdirplus(
&self,
fid: u32,
offset: u64,
count: u32,
) -> ClientResult<Vec<DirEntryPlus>>
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).
pub async fn mkdir( &self, dfid: u32, name: &[u8], mode: u32, gid: u32, ) -> ClientResult<Qid>
Sourcepub async fn mkdir_attr(
&self,
dfid: u32,
name: &[u8],
mode: u32,
gid: u32,
) -> ClientResult<Stat>
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.
pub async fn symlink( &self, dfid: u32, name: &[u8], target: &[u8], gid: u32, ) -> ClientResult<Qid>
Sourcepub async fn symlink_attr(
&self,
dfid: u32,
name: &[u8],
target: &[u8],
gid: u32,
) -> ClientResult<Stat>
pub async fn symlink_attr( &self, dfid: u32, name: &[u8], target: &[u8], gid: u32, ) -> ClientResult<Stat>
Like Self::symlink but the reply carries the new link’s full stat.
pub async fn mknod( &self, dfid: u32, name: &[u8], mode: u32, major: u32, minor: u32, gid: u32, ) -> ClientResult<Qid>
Sourcepub async fn mknod_attr(
&self,
dfid: u32,
name: &[u8],
mode: u32,
major: u32,
minor: u32,
gid: u32,
) -> ClientResult<Stat>
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.
pub async fn readlink(&self, fid: u32) -> ClientResult<Vec<u8>>
pub async fn link(&self, dfid: u32, fid: u32, name: &[u8]) -> ClientResult<()>
Sourcepub async fn link_attr(
&self,
dfid: u32,
fid: u32,
name: &[u8],
) -> ClientResult<Stat>
pub async fn link_attr( &self, dfid: u32, fid: u32, name: &[u8], ) -> ClientResult<Stat>
Like Self::link but the reply carries the linked inode’s post-op stat
(updated nlink).
pub async fn renameat( &self, olddirfid: u32, oldname: &[u8], newdirfid: u32, newname: &[u8], ) -> ClientResult<()>
pub async fn unlinkat( &self, dirfid: u32, name: &[u8], flags: u32, ) -> ClientResult<()>
Sourcepub async fn fsync_inode(
&self,
fids: &[u32],
primary: u32,
datasync: u32,
) -> ClientResult<()>
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.
Sourcepub async fn fsync(&self, fid: u32, datasync: u32) -> ClientResult<()>
pub async fn fsync(&self, fid: u32, datasync: u32) -> ClientResult<()>
Verified fsync for one fid. Multi-fid inode users call Self::fsync_inode.
Sourcepub async fn fsync_all(&self, primary: u32, datasync: u32) -> ClientResult<()>
pub async fn fsync_all(&self, primary: u32, datasync: u32) -> ClientResult<()>
Filesystem-wide barrier for this client’s outstanding durability obligations.
pub async fn statfs(&self, fid: u32) -> ClientResult<Rstatfs>
Sourcepub async fn lock(
&self,
fid: u32,
lock_type: LockType,
flags: u32,
start: u64,
length: u64,
proc_id: u32,
client_id: &[u8],
) -> ClientResult<LockStatus>
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).
Trait Implementations§
Source§impl Drop for NinePClient
impl Drop for NinePClient
Auto Trait Implementations§
impl !Freeze for NinePClient
impl !RefUnwindSafe for NinePClient
impl !UnwindSafe for NinePClient
impl Send for NinePClient
impl Sync for NinePClient
impl Unpin for NinePClient
impl UnsafeUnpin for NinePClient
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
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
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
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
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
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.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
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.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
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.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
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.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
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.