summaryrefslogtreecommitdiff
path: root/rola-bucket/src/bucket/space.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-18 20:56:05 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-18 20:56:05 +0800
commit68daa10abfe3015beca966825d32cf67c9f5d5d7 (patch)
treec28f0470240e7cdc3748cee57ef74353514c47b7 /rola-bucket/src/bucket/space.rs
parent669898193bebeadc975881bee496fe0239df76a0 (diff)
feat(bucket): implement bucket initialization and logging infrastructure
Add bucket init logic with directory structure creation and log macros for tracing
Diffstat (limited to 'rola-bucket/src/bucket/space.rs')
-rw-r--r--rola-bucket/src/bucket/space.rs22
1 files changed, 10 insertions, 12 deletions
diff --git a/rola-bucket/src/bucket/space.rs b/rola-bucket/src/bucket/space.rs
index 9559b1d..ed1311c 100644
--- a/rola-bucket/src/bucket/space.rs
+++ b/rola-bucket/src/bucket/space.rs
@@ -1,22 +1,20 @@
-use shared_constants::common::DRAFT_META_DIR;
-use space_system::{SpaceError, SpaceRoot, SpaceRootFindPattern};
-use tokio::fs::create_dir_all;
+// use log::trace;
+use shared_constants::common::FILE_BUCKET_ROOT_CONFIG;
+use shared_functions::trace;
+use space_system::{SpaceRoot, SpaceRootFindPattern};
-use crate::{AsyncBucketTransferProtocol, Bucket};
+use crate::{AsyncBucketTransferProtocol, Bucket, bucket::init::init_bucket_at};
impl<Protocol: AsyncBucketTransferProtocol + Send + Sync> SpaceRoot for Bucket<Protocol> {
fn get_pattern() -> SpaceRootFindPattern {
- SpaceRootFindPattern::IncludeDotDir(DRAFT_META_DIR.into())
+ SpaceRootFindPattern::IncludeFile(FILE_BUCKET_ROOT_CONFIG.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)?;
-
+ let path_str = path.display().to_string();
+ trace!("Creating bucket at: {}", &path_str);
+ init_bucket_at(path.into()).await?;
+ trace!("Bucket created at: {}", &path_str);
Ok(())
}
}