pub struct Repo { /* private fields */ }Expand description
A void repository — the primary SDK entry point.
Thread-safe and cheap to clone (internal state is Arc-wrapped).
Implementations§
Source§impl Repo
impl Repo
Sourcepub fn builder(path: impl AsRef<Path>) -> RepoBuilder
pub fn builder(path: impl AsRef<Path>) -> RepoBuilder
Start building a Repo.
Sourcepub fn head(&self) -> Result<CommitInfo>
pub fn head(&self) -> Result<CommitInfo>
Get information about the current HEAD commit.
Sourcepub fn stream_file(&self, path: &str) -> Result<impl Read + '_>
pub fn stream_file(&self, path: &str) -> Result<impl Read + '_>
Stream a file from HEAD. Returns a reader that fetches shards on demand.
Sourcepub fn stream_file_at(
&self,
commit: &CommitId,
path: &str,
) -> Result<impl Read + '_>
pub fn stream_file_at( &self, commit: &CommitId, path: &str, ) -> Result<impl Read + '_>
Stream a file from a specific commit.
Sourcepub fn read_file(&self, path: &str) -> Result<Vec<u8>>
pub fn read_file(&self, path: &str) -> Result<Vec<u8>>
Read a file fully into memory from HEAD.
Sourcepub fn list_dir_at(&self, refstr: &str, path: &str) -> Result<Vec<DirEntry>>
pub fn list_dir_at(&self, refstr: &str, path: &str) -> Result<Vec<DirEntry>>
List directory contents from a specific ref (branch, “HEAD”, or CID).
Sourcepub fn status(&self) -> Result<StatusResult>
pub fn status(&self) -> Result<StatusResult>
Compute repository status.
Sourcepub fn status_with_options(
&self,
patterns: Vec<String>,
observer: Option<Arc<dyn VoidObserver>>,
) -> Result<StatusResult>
pub fn status_with_options( &self, patterns: Vec<String>, observer: Option<Arc<dyn VoidObserver>>, ) -> Result<StatusResult>
Compute repository status with path patterns and optional observer.
Sourcepub fn add(&self, paths: &[&str]) -> Result<StageResult>
pub fn add(&self, paths: &[&str]) -> Result<StageResult>
Stage files for commit.
Sourcepub fn add_with_options(
&self,
paths: &[&str],
observer: Option<Arc<dyn VoidObserver>>,
) -> Result<StageResult>
pub fn add_with_options( &self, paths: &[&str], observer: Option<Arc<dyn VoidObserver>>, ) -> Result<StageResult>
Stage files with optional progress observer.
Sourcepub fn commit(&self, message: &str) -> Result<CommitInfo>
pub fn commit(&self, message: &str) -> Result<CommitInfo>
Create a commit from staged changes (or full workspace if no index).
Sourcepub fn restore(&self, paths: &[&str]) -> Result<CheckoutStats>
pub fn restore(&self, paths: &[&str]) -> Result<CheckoutStats>
Restore files from HEAD to working tree.
Sourcepub fn restore_from(
&self,
source: &str,
paths: &[&str],
) -> Result<CheckoutStats>
pub fn restore_from( &self, source: &str, paths: &[&str], ) -> Result<CheckoutStats>
Restore files from a specific ref (branch name, “HEAD”, or commit CID).
Sourcepub fn restore_from_ref(
&self,
source: &str,
paths: &[&str],
force: bool,
observer: Option<Arc<dyn VoidObserver>>,
) -> Result<CheckoutStats>
pub fn restore_from_ref( &self, source: &str, paths: &[&str], force: bool, observer: Option<Arc<dyn VoidObserver>>, ) -> Result<CheckoutStats>
Restore with full options: source ref, force flag, observer.
Sourcepub fn reset(&self, paths: &[&str]) -> Result<ResetResult>
pub fn reset(&self, paths: &[&str]) -> Result<ResetResult>
Unstage files (reset index entries to match HEAD).
Sourcepub fn reset_with_options(
&self,
paths: &[&str],
observer: Option<Arc<dyn VoidObserver>>,
) -> Result<ResetResult>
pub fn reset_with_options( &self, paths: &[&str], observer: Option<Arc<dyn VoidObserver>>, ) -> Result<ResetResult>
Unstage files with optional progress observer.
Sourcepub fn remove(
&self,
paths: &[&str],
cached_only: bool,
force: bool,
recursive: bool,
) -> Result<RemoveResult>
pub fn remove( &self, paths: &[&str], cached_only: bool, force: bool, recursive: bool, ) -> Result<RemoveResult>
Remove files from the index (and optionally working tree).
Sourcepub fn mv(&self, source: &str, dest: &str) -> Result<MoveResult>
pub fn mv(&self, source: &str, dest: &str) -> Result<MoveResult>
Move/rename a file in the index and working tree.
Sourcepub fn log(&self, limit: usize) -> Result<Vec<CommitInfo>>
pub fn log(&self, limit: usize) -> Result<Vec<CommitInfo>>
Walk commit history from HEAD, most recent first.
Stops gracefully at foreign-repo boundaries (parent commits encrypted with a different key, e.g., fork sources).
Sourcepub fn diff_staged(&self) -> Result<TreeDiff>
pub fn diff_staged(&self) -> Result<TreeDiff>
Diff staged changes against HEAD.
Sourcepub fn diff_commits(&self, from: &CommitId, to: &CommitId) -> Result<TreeDiff>
pub fn diff_commits(&self, from: &CommitId, to: &CommitId) -> Result<TreeDiff>
Diff between two commits.
Sourcepub fn branch_at(&self, name: &str, commit: &CommitId) -> Result<()>
pub fn branch_at(&self, name: &str, commit: &CommitId) -> Result<()>
Create a branch pointing at a specific commit.
Sourcepub fn delete_branch(&self, name: &str) -> Result<()>
pub fn delete_branch(&self, name: &str) -> Result<()>
Delete a branch.
Sourcepub fn switch(&self, name: &str) -> Result<CheckoutStats>
pub fn switch(&self, name: &str) -> Result<CheckoutStats>
Switch to a branch (checkout its commit).
Sourcepub fn push(&self) -> Result<PushResult>
pub fn push(&self) -> Result<PushResult>
Push commits to a remote store.
Uses the injected remote (daemon) if set via RepoBuilder::remote(),
otherwise falls back to IpfsStore from config.
Sourcepub fn push_with_options(
&self,
full: bool,
force: bool,
observer: Option<Arc<dyn VoidObserver>>,
) -> Result<PushResult>
pub fn push_with_options( &self, full: bool, force: bool, observer: Option<Arc<dyn VoidObserver>>, ) -> Result<PushResult>
Push with options: force, full, observer, etc.
Sourcepub fn pull(&self, commit_cid: &str) -> Result<PullResult>
pub fn pull(&self, commit_cid: &str) -> Result<PullResult>
Pull a specific commit from a remote store.
Uses the injected remote (daemon) if set, otherwise IpfsStore.
Sourcepub fn pull_with_options(
&self,
commit_cid: &str,
mode: CloneMode,
observer: Option<Arc<dyn VoidObserver>>,
) -> Result<PullResult>
pub fn pull_with_options( &self, commit_cid: &str, mode: CloneMode, observer: Option<Arc<dyn VoidObserver>>, ) -> Result<PullResult>
Pull with options: mode, observer.
Sourcepub fn has_remote(&self) -> bool
pub fn has_remote(&self) -> bool
Check if a remote store is configured.
Sourcepub fn add_unixfs(&self, path: &Path) -> Result<AddResult>
pub fn add_unixfs(&self, path: &Path) -> Result<AddResult>
Add a directory as a UnixFS DAG to the local object store.
Returns the root CID that IPFS gateways can serve as a website.
Equivalent to ipfs add -r <path>.
Sourcepub fn add_unixfs_bytes(&self, data: &[u8]) -> Result<FileAddResult>
pub fn add_unixfs_bytes(&self, data: &[u8]) -> Result<FileAddResult>
Add raw bytes as a UnixFS file to the local object store.
Returns detailed info about the added file.
Sourcepub fn cat_unixfs(&self, cid: &Cid) -> Result<Vec<u8>>
pub fn cat_unixfs(&self, cid: &Cid) -> Result<Vec<u8>>
Read a UnixFS file from the local object store.
Equivalent to ipfs cat <cid>.
Sourcepub fn vault(&self) -> &Arc<KeyVault>
pub fn vault(&self) -> &Arc<KeyVault>
Get the vault (for commands that need direct crypto access).
Sourcepub fn context(&self) -> &VoidContext
pub fn context(&self) -> &VoidContext
Get the underlying VoidContext.
This is a migration accessor for CLI commands that need direct access to the context while the SDK surface grows. Will be removed as all operations are covered by dedicated SDK methods.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Repo
impl !RefUnwindSafe for Repo
impl Send for Repo
impl Sync for Repo
impl Unpin for Repo
impl UnsafeUnpin for Repo
impl !UnwindSafe for Repo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more