pub trait WorktreeClientExt: WorktreeRpc {
// Provided methods
async fn read_file_prefix(
&self,
path: &str,
limit: usize,
) -> Result<Vec<u8>> { ... }
async fn read_file_chunked(&self, path: &str) -> Result<Vec<u8>> { ... }
async fn write_file_chunked(&self, path: &str, data: &[u8]) -> Result<()> { ... }
async fn mkdir_p(&self, path: &str) -> Result<()> { ... }
async fn stat_path(&self, path: &str) -> Result<StatResult> { ... }
async fn remove_path(&self, path: &str) -> Result<()> { ... }
async fn copy_path(&self, src: &str, dst: &str) -> Result<()> { ... }
async fn list_dir_path(&self, path: &str) -> Result<Vec<DirEntryInfo>> { ... }
}Expand description
High-level 9P helpers for the generated Registry worktree client.
The client itself is owned by hyprstream-rpc-std; keeping these
implementation-specific convenience operations as an extension trait lets
the AGPL daemon add ergonomics without defining an inherent impl for an
external type. Public here so the main crate (which consumes this crate)
can keep implementing/training flows against it.
Provided Methods§
Sourceasync fn read_file_prefix(&self, path: &str, limit: usize) -> Result<Vec<u8>>
async fn read_file_prefix(&self, path: &str, limit: usize) -> Result<Vec<u8>>
Read at most limit bytes without transferring the rest of a file.
Used for checkpoint metadata preflight before tensor allocation.
Sourceasync fn read_file_chunked(&self, path: &str) -> Result<Vec<u8>>
async fn read_file_chunked(&self, path: &str) -> Result<Vec<u8>>
Read an entire file via walk/open/read-loop/clunk (bounded by iounit per message).
This is the replacement for the old read_file() method. Instead of sending
the entire file in a single Cap’n Proto message (which fails for files >16MB),
this reads in iounit-sized chunks via the 9P protocol.
Sourceasync fn write_file_chunked(&self, path: &str, data: &[u8]) -> Result<()>
async fn write_file_chunked(&self, path: &str, data: &[u8]) -> Result<()>
Write an entire file via walk-parent/create/write-loop/clunk.
This is the replacement for the old write_file() method.
Sourceasync fn mkdir_p(&self, path: &str) -> Result<()>
async fn mkdir_p(&self, path: &str) -> Result<()>
Create a directory (and parents if needed), like mkdir -p.
This replaces the old mkdir(path, recursive) method.
Sourceasync fn stat_path(&self, path: &str) -> Result<StatResult>
async fn stat_path(&self, path: &str) -> Result<StatResult>
Stat a file by path. Returns a StatResult for backward compatibility.
This replaces the old stat(path) method.
Sourceasync fn remove_path(&self, path: &str) -> Result<()>
async fn remove_path(&self, path: &str) -> Result<()>
Remove a file by path via walk/remove.
This replaces the old remove(path) method.
Sourceasync fn copy_path(&self, src: &str, dst: &str) -> Result<()>
async fn copy_path(&self, src: &str, dst: &str) -> Result<()>
Copy a file by path via read + write.
This replaces the old copy(src, dst) method. Since 9P has no copy op,
this reads the source file and writes it to the destination.
Sourceasync fn list_dir_path(&self, path: &str) -> Result<Vec<DirEntryInfo>>
async fn list_dir_path(&self, path: &str) -> Result<Vec<DirEntryInfo>>
List directory entries by path.
This replaces the old list_dir(path) method. Returns directory entries
by walking to the directory, opening it, and reading the dir entries.
For now, implemented via walk + stat on the directory.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.