Skip to main content

SftpFs

Struct SftpFs 

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

Implementations§

Source§

impl SftpFs

Source

pub async fn connect(host: &str) -> Result<Self>

Source

pub async fn over<W, R>(w: W, r: R) -> Result<Self>
where W: AsyncWrite + Unpin + Send + 'static, R: AsyncRead + Unpin + Send + 'static,

Drive a session over arbitrary streams. Exists so the round-trip invariant can be asserted against an in-memory server, with no ssh anywhere.

Trait Implementations§

Source§

impl RemoteFs for SftpFs

Source§

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

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

async fn home(&self) -> Result<String>

The absolute path a fresh session starts in — the account’s home directory. Read more
Source§

async fn append(&self, path: &str, bytes: &[u8]) -> Result<()>

Append bytes to a file, creating it if absent. Read more
Source§

async fn mkdirs(&self, path: &str) -> Result<()>

Create a directory and every missing parent. Read more
Source§

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

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

async fn list_dir(&self, path: &str) -> Result<Vec<Entry>>

The n=1 case, defined in terms of the batch so that no implementation can quietly make the single listing the cheap path and the batch a loop.

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.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.