pub struct WorkstreamManager;Expand description
Two-layer workstream file lifecycle:
workstreams.yaml= curated (user-owned, highest priority)workstreams.suggested.yaml= generated suggestions- If neither exists, generate from events and write suggestions
Implementations§
Source§impl WorkstreamManager
impl WorkstreamManager
Sourcepub const SUGGESTED_FILENAME: &'static str = SUGGESTED_FILENAME
pub const SUGGESTED_FILENAME: &'static str = SUGGESTED_FILENAME
Suggested file name (machine-generated proposals)
Sourcepub const CURATED_FILENAME: &'static str = CURATED_FILENAME
pub const CURATED_FILENAME: &'static str = CURATED_FILENAME
Curated file name (user-owned source of truth)
Sourcepub fn load_effective(
out_dir: &Path,
clusterer: &dyn WorkstreamClusterer,
events: &[EventEnvelope],
) -> Result<WorkstreamsFile>
pub fn load_effective( out_dir: &Path, clusterer: &dyn WorkstreamClusterer, events: &[EventEnvelope], ) -> Result<WorkstreamsFile>
Load the effective workstreams for rendering.
Priority:
workstreams.yamlif presentworkstreams.suggested.yamlif present- generate via clusterer and persist suggested file
§Examples
When no files exist, clustering runs and writes workstreams.suggested.yaml:
use shiplog_workstreams::WorkstreamManager;
use shiplog_workstreams::RepoClusterer;
let dir = tempfile::tempdir().unwrap();
let ws = WorkstreamManager::load_effective(dir.path(), &RepoClusterer, &[]).unwrap();
assert!(ws.workstreams.is_empty());
assert!(WorkstreamManager::suggested_path(dir.path()).exists());Sourcepub fn write_suggested(
out_dir: &Path,
workstreams: &WorkstreamsFile,
) -> Result<()>
pub fn write_suggested( out_dir: &Path, workstreams: &WorkstreamsFile, ) -> Result<()>
Write machine-generated suggested workstreams.
This always overwrites workstreams.suggested.yaml.
§Examples
use shiplog_workstreams::WorkstreamManager;
use shiplog_schema::workstream::WorkstreamsFile;
let ws = WorkstreamsFile { version: 1, generated_at: Utc::now(), workstreams: vec![] };
let dir = tempfile::tempdir().unwrap();
WorkstreamManager::write_suggested(dir.path(), &ws).unwrap();
assert!(WorkstreamManager::suggested_path(dir.path()).exists());Sourcepub fn has_curated(out_dir: &Path) -> bool
pub fn has_curated(out_dir: &Path) -> bool
Check whether the curated workstreams file exists.
§Examples
use shiplog_workstreams::WorkstreamManager;
let dir = tempfile::tempdir().unwrap();
assert!(!WorkstreamManager::has_curated(dir.path()));Sourcepub fn curated_path(out_dir: &Path) -> PathBuf
pub fn curated_path(out_dir: &Path) -> PathBuf
Get the curated file path.
§Examples
use shiplog_workstreams::WorkstreamManager;
use std::path::Path;
let path = WorkstreamManager::curated_path(Path::new("./out/run_1"));
assert!(path.ends_with("workstreams.yaml"));Sourcepub fn suggested_path(out_dir: &Path) -> PathBuf
pub fn suggested_path(out_dir: &Path) -> PathBuf
Get the suggested file path.
§Examples
use shiplog_workstreams::WorkstreamManager;
use std::path::Path;
let path = WorkstreamManager::suggested_path(Path::new("./out/run_1"));
assert!(path.ends_with("workstreams.suggested.yaml"));Sourcepub fn try_load(out_dir: &Path) -> Result<Option<WorkstreamsFile>>
pub fn try_load(out_dir: &Path) -> Result<Option<WorkstreamsFile>>
Try to load curated then suggested workstreams.
Returns None when neither file exists.
§Examples
use shiplog_workstreams::WorkstreamManager;
let dir = tempfile::tempdir().unwrap();
assert!(WorkstreamManager::try_load(dir.path()).unwrap().is_none());Auto Trait Implementations§
impl Freeze for WorkstreamManager
impl RefUnwindSafe for WorkstreamManager
impl Send for WorkstreamManager
impl Sync for WorkstreamManager
impl Unpin for WorkstreamManager
impl UnsafeUnpin for WorkstreamManager
impl UnwindSafe for WorkstreamManager
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