pub struct WorkspaceManager { /* private fields */ }Expand description
Manages workspace cleanup according to a policy.
Implementations§
Source§impl WorkspaceManager
impl WorkspaceManager
Sourcepub fn new(base_dir: impl Into<PathBuf>, policy: CleanupPolicy) -> Self
pub fn new(base_dir: impl Into<PathBuf>, policy: CleanupPolicy) -> Self
Creates a new workspace manager.
Sourcepub fn policy(&self) -> CleanupPolicy
pub fn policy(&self) -> CleanupPolicy
Returns the cleanup policy.
Sourcepub fn create_workspace(
&self,
task: &TaskDefinition,
) -> Result<TaskWorkspace, WorkspaceError>
pub fn create_workspace( &self, task: &TaskDefinition, ) -> Result<TaskWorkspace, WorkspaceError>
Creates a workspace for the given task.
Sourcepub fn apply_cleanup(
&self,
workspace: &mut TaskWorkspace,
success: bool,
) -> Result<bool, WorkspaceError>
pub fn apply_cleanup( &self, workspace: &mut TaskWorkspace, success: bool, ) -> Result<bool, WorkspaceError>
Sourcepub fn rotate_workspaces(
&self,
keep_last_n: usize,
) -> Result<(), WorkspaceError>
pub fn rotate_workspaces( &self, keep_last_n: usize, ) -> Result<(), WorkspaceError>
Rotates old workspaces, keeping only the last N.
Sourcepub fn list_workspaces(&self) -> Result<Vec<WorkspaceInfo>, WorkspaceError>
pub fn list_workspaces(&self) -> Result<Vec<WorkspaceInfo>, WorkspaceError>
Lists all workspace directories in the base directory.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WorkspaceManager
impl RefUnwindSafe for WorkspaceManager
impl Send for WorkspaceManager
impl Sync for WorkspaceManager
impl Unpin for WorkspaceManager
impl UnsafeUnpin for WorkspaceManager
impl UnwindSafe for WorkspaceManager
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