refactor: move bucket operations contract (#3507)

This commit is contained in:
安正超
2026-06-17 09:10:38 +08:00
committed by GitHub
parent 5b36ef5556
commit ed55857bca
37 changed files with 130 additions and 107 deletions
+13
View File
@@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::fmt::Debug;
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
@@ -56,6 +58,17 @@ pub struct BucketInfo {
pub object_locking: bool,
}
/// Bucket-level storage operations.
#[async_trait::async_trait]
pub trait BucketOperations: Send + Sync + Debug {
type Error: std::error::Error + Send + Sync + 'static;
async fn make_bucket(&self, bucket: &str, opts: &MakeBucketOptions) -> Result<(), Self::Error>;
async fn get_bucket_info(&self, bucket: &str, opts: &BucketOptions) -> Result<BucketInfo, Self::Error>;
async fn list_bucket(&self, opts: &BucketOptions) -> Result<Vec<BucketInfo>, Self::Error>;
async fn delete_bucket(&self, bucket: &str, opts: &DeleteBucketOptions) -> Result<(), Self::Error>;
}
#[cfg(test)]
mod tests {
use super::*;