use std::sync::Arc;
use async_trait::async_trait;
use fslite_core::{FsResult, WorkspaceId};
use fslite_sqlite::{SqliteFileSystem, Workspace};
#[async_trait]
pub trait WorkspaceAdmin: Send + Sync {
async fn create_workspace(&self) -> FsResult<Workspace>;
async fn delete_workspace(&self, id: WorkspaceId) -> FsResult<()>;
}
pub struct SqliteWorkspaceAdmin(pub Arc<SqliteFileSystem>);
#[async_trait]
impl WorkspaceAdmin for SqliteWorkspaceAdmin {
async fn create_workspace(&self) -> FsResult<Workspace> {
self.0.create_workspace(Default::default()).await
}
async fn delete_workspace(&self, id: WorkspaceId) -> FsResult<()> {
self.0.delete_workspace(id).await
}
}