Skip to main content

Driver

Trait Driver 

Source
pub trait Driver: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn is_available(&self) -> bool;
    fn create_worktree<'life0, 'life1, 'async_trait>(
        &'life0 self,
        opts: &'life1 DriverOpts,
    ) -> Pin<Box<dyn Future<Output = Git2DBResult<WorktreeHandle>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_worktrees<'life0, 'life1, 'async_trait>(
        &'life0 self,
        base_repo: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Git2DBResult<Vec<WorktreeHandle>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_worktree<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        base_repo: &'life1 Path,
        branch: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Git2DBResult<Option<WorktreeHandle>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Storage driver trait (Docker’s graphdriver interface)

All storage drivers must implement this trait to provide worktree creation with optional storage optimization.

Required Methods§

Source

fn name(&self) -> &'static str

Get driver name (e.g., “overlay2”, “vfs”)

Source

fn is_available(&self) -> bool

Check if this driver is available on the current system

Source

fn create_worktree<'life0, 'life1, 'async_trait>( &'life0 self, opts: &'life1 DriverOpts, ) -> Pin<Box<dyn Future<Output = Git2DBResult<WorktreeHandle>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a worktree using this driver

This creates a git worktree, potentially with storage optimization layers underneath (overlayfs, reflinks, etc.).

Source

fn get_worktrees<'life0, 'life1, 'async_trait>( &'life0 self, base_repo: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Git2DBResult<Vec<WorktreeHandle>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all worktrees managed by this driver for the given repository

Returns all existing worktrees for this repository that were created by this storage driver, maintaining storage optimization context.

Source

fn get_worktree<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, base_repo: &'life1 Path, branch: &'life2 str, ) -> Pin<Box<dyn Future<Output = Git2DBResult<Option<WorktreeHandle>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get specific worktree by branch name (if it exists)

Returns the worktree handle if it exists and is managed by this driver, or None if the worktree doesn’t exist or isn’t managed by this driver.

Implementors§