Skip to main content

VcsBackend

Trait VcsBackend 

Source
pub trait VcsBackend: Send + Sync {
Show 19 methods // Required methods fn init(&self, path: &Path) -> Result<(), NapError>; fn commit( &self, path: &Path, message: &str, author: &str, ) -> Result<String, NapError>; fn read_file_at_ref( &self, repo_path: &Path, file_path: &str, reference: Option<&str>, ) -> Result<String, NapError>; fn log( &self, path: &Path, file: Option<&str>, limit: usize, ) -> Result<Vec<CommitInfo>, NapError>; fn create_branch(&self, path: &Path, name: &str) -> Result<(), NapError>; fn switch_branch(&self, path: &Path, name: &str) -> Result<(), NapError>; fn current_branch(&self, path: &Path) -> Result<String, NapError>; fn head_hash(&self, path: &Path) -> Result<String, NapError>; fn list_branches(&self, path: &Path) -> Result<Vec<String>, NapError>; fn add_remote( &self, path: &Path, name: &str, url: &str, ) -> Result<(), NapError>; fn remove_remote(&self, path: &Path, name: &str) -> Result<(), NapError>; fn list_remotes( &self, path: &Path, ) -> Result<Vec<(String, String)>, NapError>; fn push( &self, path: &Path, remote: Option<&str>, branch: Option<&str>, ) -> Result<(), NapError>; fn pull( &self, path: &Path, remote: Option<&str>, branch: Option<&str>, ) -> Result<(), NapError>; // Provided methods fn revert( &self, _path: &Path, _commit_hash: &str, ) -> Result<String, NapError> { ... } fn resolve_branch_head( &self, path: &Path, branch: &str, ) -> Result<String, NapError> { ... } fn remote_url_base(&self) -> Result<String, NapError> { ... } fn file_metadata_at_ref( &self, _repo_path: &Path, _file_path: &str, _reference: &str, ) -> Result<Option<BTreeMap<String, String>>, NapError> { ... } fn read_provenance_blob( &self, _repo_path: &Path, _address: &str, ) -> Result<String, NapError> { ... }
}
Expand description

Low-level abstraction over a version control system.

LoreBackend

Most consumer code should use [RepoService] instead — it adds permissions, context-document management, and a workspace-lifecycle API on top of this trait.

Required Methods§

Source

fn init(&self, path: &Path) -> Result<(), NapError>

Initialize a new repository at the given path.

Source

fn commit( &self, path: &Path, message: &str, author: &str, ) -> Result<String, NapError>

Stage all files and create a commit.

Source

fn read_file_at_ref( &self, repo_path: &Path, file_path: &str, reference: Option<&str>, ) -> Result<String, NapError>

Read a file’s content at a specific ref (branch, tag, or commit hash). If reference is None, reads from the current working tree.

Source

fn log( &self, path: &Path, file: Option<&str>, limit: usize, ) -> Result<Vec<CommitInfo>, NapError>

Get the commit log for the repository, optionally filtered to a specific file.

Source

fn create_branch(&self, path: &Path, name: &str) -> Result<(), NapError>

Create a new branch.

Source

fn switch_branch(&self, path: &Path, name: &str) -> Result<(), NapError>

Switch to a branch.

Source

fn current_branch(&self, path: &Path) -> Result<String, NapError>

Get the current branch name.

Source

fn head_hash(&self, path: &Path) -> Result<String, NapError>

Get the HEAD commit hash.

Source

fn list_branches(&self, path: &Path) -> Result<Vec<String>, NapError>

List all branches.

Source

fn add_remote(&self, path: &Path, name: &str, url: &str) -> Result<(), NapError>

Add a remote.

Source

fn remove_remote(&self, path: &Path, name: &str) -> Result<(), NapError>

Remove a remote.

Source

fn list_remotes(&self, path: &Path) -> Result<Vec<(String, String)>, NapError>

List remotes as (name, url) pairs.

Source

fn push( &self, path: &Path, remote: Option<&str>, branch: Option<&str>, ) -> Result<(), NapError>

Push the current branch to its upstream / a named remote.

Source

fn pull( &self, path: &Path, remote: Option<&str>, branch: Option<&str>, ) -> Result<(), NapError>

Pull the current branch from its upstream / a named remote.

Provided Methods§

Source

fn revert(&self, _path: &Path, _commit_hash: &str) -> Result<String, NapError>

Revert a commit by creating a new commit that undoes it.

Source

fn resolve_branch_head( &self, path: &Path, branch: &str, ) -> Result<String, NapError>

Resolve the most recent commit hash on a given branch.

The default implementation returns an error — backends that support branch-based resolution must override this.

Source

fn remote_url_base(&self) -> Result<String, NapError>

Get the remote URL base for constructing repository URLs.

The default implementation returns an error — backends that support remote URL construction must override this.

Source

fn file_metadata_at_ref( &self, _repo_path: &Path, _file_path: &str, _reference: &str, ) -> Result<Option<BTreeMap<String, String>>, NapError>

Read file metadata attached to a path at a specific revision.

Lore file metadata is addressed by working-tree path plus revision, not by the raw content hash of the file bytes.

Source

fn read_provenance_blob( &self, _repo_path: &Path, _address: &str, ) -> Result<String, NapError>

Read a readable immutable provenance artifact by Lore address/hash.

Production Lore verifies immutable fragment addressing internally. NAP uses this only for known readable provenance artifacts, never arbitrary binary assets.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§