diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-18 02:47:32 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-18 02:47:32 +0800 |
| commit | 0b8e6e7d18abb94bd99553dc1d2b0ba5d4f265ea (patch) | |
| tree | 97a7c3430d56bfcb885cbfff0b011362671dd474 /rola-bucket/src/bucket/space.rs | |
| parent | ebd46942c3fcc7939e5567a797a55198148301ea (diff) | |
refactor: extract shared utilities and add space-system crate
Extract rola-vcs/internal_macros into shared utils crates
(shared_constants, shared_macros, space-system) and implement
the Bucket enum with async space management
Diffstat (limited to 'rola-bucket/src/bucket/space.rs')
| -rw-r--r-- | rola-bucket/src/bucket/space.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/rola-bucket/src/bucket/space.rs b/rola-bucket/src/bucket/space.rs new file mode 100644 index 0000000..9559b1d --- /dev/null +++ b/rola-bucket/src/bucket/space.rs @@ -0,0 +1,22 @@ +use shared_constants::common::DRAFT_META_DIR; +use space_system::{SpaceError, SpaceRoot, SpaceRootFindPattern}; +use tokio::fs::create_dir_all; + +use crate::{AsyncBucketTransferProtocol, Bucket}; + +impl<Protocol: AsyncBucketTransferProtocol + Send + Sync> SpaceRoot for Bucket<Protocol> { + fn get_pattern() -> SpaceRootFindPattern { + SpaceRootFindPattern::IncludeDotDir(DRAFT_META_DIR.into()) + } + + async fn create_space(path: &std::path::Path) -> Result<(), space_system::SpaceError> { + let draft_meta_dir = path.join(DRAFT_META_DIR); + + // Create workspace directory + create_dir_all(&draft_meta_dir) + .await + .map_err(SpaceError::from)?; + + Ok(()) + } +} |
