Skip to main content

VcsProvider

Trait VcsProvider 

Source
pub trait VcsProvider: Send + Sync {
    // Required methods
    fn find_repo_root(&self, start: &Path) -> Option<PathBuf>;
    fn file_at_commit(
        &self,
        repo_root: &Path,
        rel_path: &str,
        commit: &str,
    ) -> Result<String, String>;
    fn verify_commit_signature(
        &self,
        repo_root: &Path,
        commit: &str,
    ) -> Result<(), SignatureFailure>;
    fn load_trusted_signers(&self, signers: &[TrustedSigner]) -> usize;
}
Expand description

The git operations the runtime needs, as an interface.

Implementations must be cheap to clone-by-Arc and safe to call from any thread: a provider is shared by every thread evaluating in a GlobalEnv.

Required Methods§

Source

fn find_repo_root(&self, start: &Path) -> Option<PathBuf>

Walk upward from start (a file or directory) to the enclosing git working-tree root, or None when start is not inside a repository.

Source

fn file_at_commit( &self, repo_root: &Path, rel_path: &str, commit: &str, ) -> Result<String, String>

Read rel_path (relative to repo_root) as it existed at commit.

Source

fn verify_commit_signature( &self, repo_root: &Path, commit: &str, ) -> Result<(), SignatureFailure>

Verify that commit in repo_root carries a cryptographically valid signature made by one of the keys installed by load_trusted_signers.

Source

fn load_trusted_signers(&self, signers: &[TrustedSigner]) -> usize

Install the set of keys trusted to sign versioned dependency commits, replacing any previously installed set. Returns the number of keys successfully loaded; malformed or unreadable keys are warned about rather than aborting.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl VcsProvider for ProjectVcs

Available on crate feature deps and non-WebAssembly only.