Skip to main content

SessionFsProvider

Trait SessionFsProvider 

Source
pub trait SessionFsProvider:
    Send
    + Sync
    + 'static {
    // Provided methods
    fn read_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<String, FsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn write_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
        content: &'life2 str,
        mode: Option<i64>,
    ) -> Pin<Box<dyn Future<Output = Result<(), FsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn append_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
        content: &'life2 str,
        mode: Option<i64>,
    ) -> Pin<Box<dyn Future<Output = Result<(), FsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, FsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn stat<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<FileInfo, FsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn mkdir<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
        recursive: bool,
        mode: Option<i64>,
    ) -> Pin<Box<dyn Future<Output = Result<(), FsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn readdir<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, FsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn readdir_with_types<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, FsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn rm<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 str,
        recursive: bool,
        force: bool,
    ) -> Pin<Box<dyn Future<Output = Result<(), FsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn rename<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        src: &'life1 str,
        dest: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), FsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Implementor-supplied filesystem backing for a session.

Each method takes a path using the conventions declared in SessionFsConfig::conventions and returns the operation’s result. The SDK adapts every Result<_, FsError> into the JSON-RPC response shape expected by the GitHub Copilot CLI.

§Concurrency

Implementations MUST be Send + Sync and safe for concurrent invocation across distinct paths. The SDK dispatches each inbound sessionFs.* request on its own spawned task. Use internal synchronization (e.g. tokio::sync::Mutex keyed by path) if your backing store requires ordering.

§Forward compatibility

Methods on this trait have default implementations that return Err(FsError::Other("operation not supported".into())). When the CLI schema grows new sessionFs.* methods, the SDK adds them to this trait with default impls so existing implementations continue to compile. Override only the methods relevant to your backing store.

Provided Methods§

Source

fn read_file<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, FsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the full contents of a file as UTF-8.

Source

fn write_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, content: &'life2 str, mode: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<(), FsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Write content to a file, creating parent directories if needed.

Source

fn append_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, content: &'life2 str, mode: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<(), FsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Append content to a file, creating parent directories if needed.

Source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, FsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check whether a path exists.

Returns Ok(false) for non-existent paths, not FsError::NotFound.

Source

fn stat<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<FileInfo, FsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get metadata about a file or directory.

Source

fn mkdir<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, recursive: bool, mode: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<(), FsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a directory. When recursive, missing parents are also created.

Source

fn readdir<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, FsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List entry names in a directory.

Source

fn readdir_with_types<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, FsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List directory entries with type information.

Source

fn rm<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, recursive: bool, force: bool, ) -> Pin<Box<dyn Future<Output = Result<(), FsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a file or directory. When force, missing paths are not an error. When recursive, directory contents are removed as well.

Source

fn rename<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, src: &'life1 str, dest: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), FsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Rename or move a file or directory.

Implementors§