use std::fmt::Debug;
use std::path::Path;
use std::path::PathBuf;
use thiserror::Error;
use crate::ref_name::WorkspaceName;
#[derive(Error, Debug)]
pub enum WorkspaceStoreError {
#[error(transparent)]
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
}
pub trait WorkspaceStore: Send + Sync + Debug {
fn name(&self) -> &str;
fn add(&self, workspace_name: &WorkspaceName, path: &Path) -> Result<(), WorkspaceStoreError>;
fn forget(&self, workspace_names: &[&WorkspaceName]) -> Result<(), WorkspaceStoreError>;
fn rename(
&self,
old_name: &WorkspaceName,
new_name: &WorkspaceName,
) -> Result<(), WorkspaceStoreError>;
fn get_workspace_path(
&self,
workspace_name: &WorkspaceName,
) -> Result<Option<PathBuf>, WorkspaceStoreError>;
}