pub trait RemoteFs {
// Required methods
async fn read_batch(&self, paths: &[String]) -> Vec<Result<Vec<u8>>> ⓘ;
async fn read_ranges(&self, reqs: &[RangeReq]) -> Vec<Result<Vec<u8>>> ⓘ;
async fn list_dirs(&self, paths: &[String]) -> Vec<Result<Vec<Entry>>> ⓘ;
async fn home(&self) -> Result<String>;
fn round_trips(&self) -> u64;
// Provided method
async fn list_dir(&self, path: &str) -> Result<Vec<Entry>> { ... }
}Required Methods§
Sourceasync fn read_batch(&self, paths: &[String]) -> Vec<Result<Vec<u8>>> ⓘ
async fn read_batch(&self, paths: &[String]) -> Vec<Result<Vec<u8>>> ⓘ
Read whole files. Implementations must issue every request before awaiting any reply; doing otherwise silently reintroduces O(N) round trips.
Sourceasync fn read_ranges(&self, reqs: &[RangeReq]) -> Vec<Result<Vec<u8>>> ⓘ
async fn read_ranges(&self, reqs: &[RangeReq]) -> Vec<Result<Vec<u8>>> ⓘ
Read byte ranges. Chunking is the implementation’s business; what matters here is that the whole set is issued together, so a one-megabyte range costs one round trip rather than the thirty-two its chunks would suggest.
Sourceasync fn list_dirs(&self, paths: &[String]) -> Vec<Result<Vec<Entry>>> ⓘ
async fn list_dirs(&self, paths: &[String]) -> Vec<Result<Vec<Entry>>> ⓘ
List several directories at once. One listing carries every entry’s attrs, which is what removes per-file stat from the page path; batching the listings is what holds a symlink check over a deep path at one round trip rather than one per path component.
Sourceasync fn home(&self) -> Result<String>
async fn home(&self) -> Result<String>
The absolute path a fresh session starts in — the account’s home directory.
The one question about the remote that cannot be answered from a path, and the
reason an alias can be written without a base at all. ~ is shell syntax and
the transport never runs a shell, so expanding it locally would produce this
machine’s home rather than the remote one.
Asked once per alias at startup, never on a page path, so it costs no round trip that a reader waits for.
Sourcefn round_trips(&self) -> u64
fn round_trips(&self) -> u64
Flushes issued so far. One flush is one remote round trip, so this is the invariant made observable, and assertable in tests.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".