pub struct Storage { /* private fields */ }Expand description
Filesystem-based storage backend.
Implementations§
Source§impl Storage
impl Storage
Sourcepub fn open(project_root: &Path) -> Result<Self, StorageError>
pub fn open(project_root: &Path) -> Result<Self, StorageError>
Open storage at the given project root.
Sourcepub fn init(project_root: &Path) -> Result<Self, StorageError>
pub fn init(project_root: &Path) -> Result<Self, StorageError>
Initialize a new DirtyData project.
Sourcepub fn load_graph(&self) -> Result<Graph, StorageError>
pub fn load_graph(&self) -> Result<Graph, StorageError>
Load the current graph.
Sourcepub fn save_graph(&self, graph: &Graph) -> Result<(), StorageError>
pub fn save_graph(&self, graph: &Graph) -> Result<(), StorageError>
Save the current graph.
Sourcepub fn read_head(&self) -> Result<String, StorageError>
pub fn read_head(&self) -> Result<String, StorageError>
Read the current branch name from HEAD
Sourcepub fn write_head(&self, branch: &str) -> Result<(), StorageError>
pub fn write_head(&self, branch: &str) -> Result<(), StorageError>
Update HEAD to point to a branch
Sourcepub fn read_branch(&self, branch: &str) -> Result<Option<PatchId>, StorageError>
pub fn read_branch(&self, branch: &str) -> Result<Option<PatchId>, StorageError>
Get the PatchId a branch points to
Sourcepub fn write_branch(
&self,
branch: &str,
patch_id: PatchId,
) -> Result<(), StorageError>
pub fn write_branch( &self, branch: &str, patch_id: PatchId, ) -> Result<(), StorageError>
Update a branch to point to a PatchId
Sourcepub fn list_branches(&self) -> Result<Vec<String>, StorageError>
pub fn list_branches(&self) -> Result<Vec<String>, StorageError>
List all local branches
Sourcepub fn save_patch(&self, patch: &Patch) -> Result<(), StorageError>
pub fn save_patch(&self, patch: &Patch) -> Result<(), StorageError>
Save a patch.
Sourcepub fn load_patch(&self, id: &PatchId) -> Result<Patch, StorageError>
pub fn load_patch(&self, id: &PatchId) -> Result<Patch, StorageError>
Load a patch by ID.
Sourcepub fn load_all_patches(&self) -> Result<Vec<Patch>, StorageError>
pub fn load_all_patches(&self) -> Result<Vec<Patch>, StorageError>
Load all patches in order.
Sourcepub fn load_patch_ancestry(
&self,
tip: PatchId,
) -> Result<Vec<Patch>, StorageError>
pub fn load_patch_ancestry( &self, tip: PatchId, ) -> Result<Vec<Patch>, StorageError>
Load patches starting from a tip, following parents backwards, then return in chronological order.
Auto Trait Implementations§
impl Freeze for Storage
impl RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnsafeUnpin for Storage
impl UnwindSafe for Storage
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
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.