pub struct ShadowRepo { /* private fields */ }Expand description
A shared shadow bare git repository for a workspace.
Per-session checkpoint chains live under refs/sessions/<sid>/HEAD.
Implementations§
Source§impl ShadowRepo
impl ShadowRepo
Sourcepub fn open(workspace: impl Into<PathBuf>) -> Result<Self>
pub fn open(workspace: impl Into<PathBuf>) -> Result<Self>
Open or create the shadow repo for workspace. Idempotent.
Returns an error if git is not on PATH.
Sourcepub fn open_at(
workspace: impl Into<PathBuf>,
shadow_dir: impl Into<PathBuf>,
) -> Result<Self>
pub fn open_at( workspace: impl Into<PathBuf>, shadow_dir: impl Into<PathBuf>, ) -> Result<Self>
Open or create a shadow repo with an explicit shadow_dir,
bypassing paths::user_data_dir() resolution.
Used by tests so they don’t have to mutate RECURSIVE_HOME
(and thus don’t need the cross-module env lock), letting
checkpoint tests run in parallel. Production callers should
stick to [open].
Sourcepub fn snapshot_for_session(
&self,
session_id: &str,
message: &str,
) -> Result<CheckpointId>
pub fn snapshot_for_session( &self, session_id: &str, message: &str, ) -> Result<CheckpointId>
Snapshot the current workspace state and advance
refs/sessions/<session_id>/HEAD to the new commit.
Per-session temporary index files prevent concurrent snapshots from racing each other.
Sourcepub fn list_for_session(&self, session_id: &str) -> Result<Vec<CheckpointInfo>>
pub fn list_for_session(&self, session_id: &str) -> Result<Vec<CheckpointInfo>>
List checkpoints for session_id in reverse chronological order.
Sourcepub fn read_file_at(
&self,
checkpoint: &CheckpointId,
path: &str,
) -> Result<Option<Vec<u8>>>
pub fn read_file_at( &self, checkpoint: &CheckpointId, path: &str, ) -> Result<Option<Vec<u8>>>
Read a single file’s contents at checkpoint.
Returns Ok(None) if the file did not exist at that checkpoint.
Sourcepub fn restore_paths(
&self,
checkpoint: &CheckpointId,
paths: &[String],
) -> Result<RestoreStats>
pub fn restore_paths( &self, checkpoint: &CheckpointId, paths: &[String], ) -> Result<RestoreStats>
Restore only the given workspace-relative file paths to
their state at checkpoint. Files not in paths remain
untouched. Files present in the workspace but not in the
checkpoint tree are deleted (when listed in paths).
Sourcepub fn diff(
&self,
a: &CheckpointId,
b: Option<&CheckpointId>,
paths: &[String],
) -> Result<String>
pub fn diff( &self, a: &CheckpointId, b: Option<&CheckpointId>, paths: &[String], ) -> Result<String>
Diff between two checkpoints (or a vs current workspace if
b is None), optionally limited to paths.
Sourcepub fn changed_paths(
&self,
a: &CheckpointId,
b: &CheckpointId,
) -> Result<Vec<String>>
pub fn changed_paths( &self, a: &CheckpointId, b: &CheckpointId, ) -> Result<Vec<String>>
List file paths changed between checkpoints a and b.
Used for “shell-diff” attribution after run_shell calls.
Trait Implementations§
Source§impl Clone for ShadowRepo
impl Clone for ShadowRepo
Source§fn clone(&self) -> ShadowRepo
fn clone(&self) -> ShadowRepo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ShadowRepo
impl RefUnwindSafe for ShadowRepo
impl Send for ShadowRepo
impl Sync for ShadowRepo
impl Unpin for ShadowRepo
impl UnsafeUnpin for ShadowRepo
impl UnwindSafe for ShadowRepo
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,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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