use std::collections::BTreeSet;
use std::path::{Path, PathBuf};
use crate::workspace::Workspace;
use prov_graph::error::Result;
use prov_store::fs::Storage;
use prov_store::index::IndexStore;
pub use prov_history::{
BLOBS_DIR, CaptureNote, Captured, Change, Conflict, DiffRow, Disposition, EVENTS_DIR, Event,
FORGOTTEN_STEM, FileEntry, Forgotten, HISTORY_DIR, HistoryIssue, HistoryStore, Latest,
ManifestDiff, Presence, Pruned, RestoreOp, RestorePlan, Retention, Retrieved, Scope,
StoreLocation, Subject, Summary, TRIGGER_MANUAL, Version, blob_path, comparable, event_path,
manifest_diff, shard_of, store_dir, under,
};
impl<FS: Storage, IdP, Ix: IndexStore> Workspace<FS, IdP, Ix> {
pub async fn history_capture_set(&self, root_doc: &Path) -> Result<Vec<PathBuf>> {
self.history_store().capture_set(root_doc).await
}
pub async fn history_summary(&self, root_doc: &Path) -> Result<Summary> {
self.history_store().summary(root_doc).await
}
pub async fn history_store_bytes(&self, root_doc: &Path) -> Result<u64> {
self.history_store().store_bytes(root_doc).await
}
pub async fn history_list(&self, root_doc: &Path) -> Result<Vec<Event>> {
self.history_store().list(root_doc).await
}
pub async fn history_event(&self, root_doc: &Path, id: &str) -> Result<Option<Event>> {
self.history_store().event(root_doc, id).await
}
pub async fn history_missing_blobs(
&self,
root_doc: &Path,
event: &Event,
) -> Result<BTreeSet<PathBuf>> {
self.history_store().missing_blobs(root_doc, event).await
}
pub async fn history_cat(
&self,
root_doc: &Path,
event: &Event,
subject: &Subject,
) -> Result<Retrieved> {
self.history_store().cat(root_doc, event, subject).await
}
pub async fn history_log(&self, root_doc: &Path, subject: &Subject) -> Result<Vec<Version>> {
self.history_store().log(root_doc, subject).await
}
pub async fn history_forgotten(&self, root_doc: &Path) -> Result<BTreeSet<String>> {
self.history_store().forgotten(root_doc).await
}
pub async fn history_findings(&self, root_doc: &Path) -> Result<Vec<HistoryIssue>> {
self.history_store().findings(root_doc).await
}
pub async fn history_index_text(&self, index: &Path) -> Result<String> {
self.history_store().index_text(index).await
}
pub(crate) async fn history_pointer_text(
&self,
root_doc: &Path,
store_index: &Path,
) -> Result<String> {
self.history_store()
.pointer_text(root_doc, store_index)
.await
}
pub async fn history_restore_plan(
&self,
root_doc: &Path,
event: &Event,
scope: &Scope,
exact: bool,
) -> Result<RestorePlan> {
self.history_store()
.restore_plan(root_doc, event, scope, exact)
.await
}
pub async fn history_prune_plan(
&self,
root_doc: &Path,
retention: &Retention,
) -> Result<Pruned> {
self.history_store().prune_plan(root_doc, retention).await
}
pub async fn history_capture(
&mut self,
root_doc: &Path,
now: &str,
note: CaptureNote<'_>,
) -> Result<Captured> {
self.history_store_mut().capture(root_doc, now, note).await
}
pub async fn history_restore(
&mut self,
root_doc: &Path,
plan: &RestorePlan,
force: bool,
) -> Result<()> {
self.history_store_mut()
.restore(root_doc, plan, force)
.await
}
pub async fn history_prune(&mut self, root_doc: &Path, plan: &Pruned) -> Result<()> {
self.history_store_mut().prune(root_doc, plan).await
}
pub async fn history_forget(
&mut self,
root_doc: &Path,
subject: &Subject,
now: &str,
force: bool,
) -> Result<Forgotten> {
self.history_store_mut()
.forget(root_doc, subject, now, force)
.await
}
}
mod uncaptured;
pub use uncaptured::{Omission, Uncaptured};
#[cfg(all(test, feature = "yaml"))]
mod tests;