1use std::sync::Arc;
2
3use async_trait::async_trait;
4use fslite_core::{FsResult, WorkspaceId};
5use fslite_sqlite::{SqliteFileSystem, Workspace};
6
7#[async_trait]
12pub trait WorkspaceAdmin: Send + Sync {
13 async fn create_workspace(&self) -> FsResult<Workspace>;
15 async fn delete_workspace(&self, id: WorkspaceId) -> FsResult<()>;
17}
18
19pub struct SqliteWorkspaceAdmin(pub Arc<SqliteFileSystem>);
21
22#[async_trait]
23impl WorkspaceAdmin for SqliteWorkspaceAdmin {
24 async fn create_workspace(&self) -> FsResult<Workspace> {
25 self.0.create_workspace(Default::default()).await
26 }
27
28 async fn delete_workspace(&self, id: WorkspaceId) -> FsResult<()> {
29 self.0.delete_workspace(id).await
30 }
31}