pub struct MetadataStore { /* private fields */ }Expand description
The SQLite metadata store.
Implementations§
Source§impl MetadataStore
impl MetadataStore
Sourcepub fn open(path: &Path) -> Result<Self, MetaError>
pub fn open(path: &Path) -> Result<Self, MetaError>
Open or create a metadata database at the given path.
Sourcepub fn open_in_memory() -> Result<Self, MetaError>
pub fn open_in_memory() -> Result<Self, MetaError>
Open an in-memory metadata database (for testing).
Sourcepub fn conn(&self) -> &Connection
pub fn conn(&self) -> &Connection
Get a reference to the underlying SQLite connection.
Used internally for direct queries that don’t have dedicated methods.
Sourcepub fn store_patch(&self, patch: &Patch) -> Result<(), MetaError>
pub fn store_patch(&self, patch: &Patch) -> Result<(), MetaError>
Store a patch in the metadata database.
Sourcepub fn set_branch(
&self,
name: &BranchName,
target: &PatchId,
) -> Result<(), MetaError>
pub fn set_branch( &self, name: &BranchName, target: &PatchId, ) -> Result<(), MetaError>
Store a branch pointer.
Sourcepub fn get_branch(&self, name: &BranchName) -> Result<PatchId, MetaError>
pub fn get_branch(&self, name: &BranchName) -> Result<PatchId, MetaError>
Get a branch target.
Sourcepub fn store_edge(
&self,
parent: &PatchId,
child: &PatchId,
) -> Result<(), MetaError>
pub fn store_edge( &self, parent: &PatchId, child: &PatchId, ) -> Result<(), MetaError>
Store a DAG edge.
Sourcepub fn get_edges(
&self,
patch_id: &PatchId,
) -> Result<(Vec<PatchId>, Vec<PatchId>), MetaError>
pub fn get_edges( &self, patch_id: &PatchId, ) -> Result<(Vec<PatchId>, Vec<PatchId>), MetaError>
Get parent and child IDs for a patch.
Sourcepub fn working_set_add(
&self,
path: &RepoPath,
status: FileStatus,
) -> Result<(), MetaError>
pub fn working_set_add( &self, path: &RepoPath, status: FileStatus, ) -> Result<(), MetaError>
Add a file to the working set.
Sourcepub fn working_set_remove(&self, path: &RepoPath) -> Result<(), MetaError>
pub fn working_set_remove(&self, path: &RepoPath) -> Result<(), MetaError>
Remove a file from the working set.
Sourcepub fn working_set(&self) -> Result<Vec<(String, FileStatus)>, MetaError>
pub fn working_set(&self) -> Result<Vec<(String, FileStatus)>, MetaError>
Get the working set.
Sourcepub fn set_config(&self, key: &str, value: &str) -> Result<(), MetaError>
pub fn set_config(&self, key: &str, value: &str) -> Result<(), MetaError>
Store a configuration value.
Sourcepub fn list_config(&self) -> Result<Vec<(String, String)>, MetaError>
pub fn list_config(&self) -> Result<Vec<(String, String)>, MetaError>
List all config key-value pairs.
Sourcepub fn get_config(&self, key: &str) -> Result<Option<String>, MetaError>
pub fn get_config(&self, key: &str) -> Result<Option<String>, MetaError>
Get a configuration value.
Sourcepub fn patch_count(&self) -> Result<i64, MetaError>
pub fn patch_count(&self) -> Result<i64, MetaError>
Get the number of patches stored.
pub fn store_public_key( &self, author: &str, public_key_bytes: &[u8], ) -> Result<(), MetaError>
pub fn get_public_key(&self, author: &str) -> Result<Option<Vec<u8>>, MetaError>
pub fn store_signature( &self, patch_id: &str, signature_bytes: &[u8], ) -> Result<(), MetaError>
pub fn get_signature( &self, patch_id: &str, ) -> Result<Option<Vec<u8>>, MetaError>
Sourcepub fn store_file_tree(
&self,
patch_id: &PatchId,
tree: &FileTree,
) -> Result<(), MetaError>
pub fn store_file_tree( &self, patch_id: &PatchId, tree: &FileTree, ) -> Result<(), MetaError>
Store a FileTree for a given patch ID.
Replaces all existing entries for that patch_id (DELETE + INSERT in transaction).
Sourcepub fn load_file_tree(
&self,
patch_id: &PatchId,
) -> Result<Option<FileTree>, MetaError>
pub fn load_file_tree( &self, patch_id: &PatchId, ) -> Result<Option<FileTree>, MetaError>
Load a FileTree for a given patch ID from the database.
Returns None if no entries exist for that patch_id.
Sourcepub fn file_tree_contains(
&self,
patch_id: &PatchId,
path: &str,
) -> Result<bool, MetaError>
pub fn file_tree_contains( &self, patch_id: &PatchId, path: &str, ) -> Result<bool, MetaError>
Check if a path exists in the file tree for a given patch ID.
Sourcepub fn reflog_push(
&self,
old_head: &PatchId,
new_head: &PatchId,
message: &str,
) -> Result<(), MetaError>
pub fn reflog_push( &self, old_head: &PatchId, new_head: &PatchId, message: &str, ) -> Result<(), MetaError>
Append an entry to the reflog.
Sourcepub fn reflog_list(&self) -> Result<Vec<(String, String, String)>, MetaError>
pub fn reflog_list(&self) -> Result<Vec<(String, String, String)>, MetaError>
Get the full reflog (newest first).
Sourcepub fn reflog_clear(&self) -> Result<usize, MetaError>
pub fn reflog_clear(&self) -> Result<usize, MetaError>
Clear the entire reflog.
Auto Trait Implementations§
impl !Freeze for MetadataStore
impl !RefUnwindSafe for MetadataStore
impl Send for MetadataStore
impl !Sync for MetadataStore
impl Unpin for MetadataStore
impl UnsafeUnpin for MetadataStore
impl !UnwindSafe for MetadataStore
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> 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