From 7879ac01b24eb9723ec0a814adaee1fc9c52610a Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 18 Jun 2026 04:40:25 +0800 Subject: feat(rola-cli): implement bucket creation and CLI entry point Add bucket creation logic with pre-checks, localized error handling, and a basic CLI entry point using the mingling framework. Introduce a placeholder protocol for bucket transfer testing. --- rola-bucket/src/protocol.rs | 3 +++ rola-bucket/src/protocol/placeholder.rs | 45 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 rola-bucket/src/protocol/placeholder.rs (limited to 'rola-bucket') diff --git a/rola-bucket/src/protocol.rs b/rola-bucket/src/protocol.rs index 5523176..ba50a42 100644 --- a/rola-bucket/src/protocol.rs +++ b/rola-bucket/src/protocol.rs @@ -8,6 +8,9 @@ pub use error::*; mod local_fs; pub use local_fs::*; +mod placeholder; +pub use placeholder::*; + /// Request used in [BucketTransferProtocol] or [AsyncBucketTransferProtocol] pub struct UploadToBucketRequest<'a, ExtraInfo> where diff --git a/rola-bucket/src/protocol/placeholder.rs b/rola-bucket/src/protocol/placeholder.rs new file mode 100644 index 0000000..6fd5a10 --- /dev/null +++ b/rola-bucket/src/protocol/placeholder.rs @@ -0,0 +1,45 @@ +use crate::BucketTransferProtocol; + +/// A placeholder implementation of the bucket transfer protocol. +/// +/// This struct serves as a temporary or stub implementation of +/// [`BucketTransferProtocol`], intended for use in contexts where +/// actual data transfer is not required (e.g., testing, scaffolding, +/// or as a default before a real implementation is provided). +/// +/// Calling any of the transfer methods on this implementation will +/// result in a panic with `unreachable!()`, signaling that the +/// placeholder should be replaced before use. +pub struct NoProtocol; + +impl BucketTransferProtocol for NoProtocol { + type ExtraInfo = (); + + fn upload_to_bucket( + &self, + _req: &super::UploadToBucketRequest, + ) -> Result<(), super::BucketTransferProtocolError> { + unreachable!() + } + + fn download_from_bucket( + &self, + _req: &super::DownloadFromBucketRequest, + ) -> Result<(), super::BucketTransferProtocolError> { + unreachable!() + } + + fn transfer_to_client( + &self, + _req: &super::TransferToClientRequest, + ) -> Result<(), super::BucketTransferProtocolError> { + unreachable!() + } + + fn receive_from_client( + &self, + _req: &super::ReceiveFromClientRequest, + ) -> Result<(), super::BucketTransferProtocolError> { + unreachable!() + } +} -- cgit