Skip to main content

MetaEngine

Trait MetaEngine 

Source
pub trait MetaEngine: Sized {
    type Uri: ?Sized;

    // Required methods
    fn new<T: AsRef<Self::Uri>>(base_dir: T) -> EngineResult<Self>;
    fn create_bucket_meta(
        &self,
        meta: &BucketMeta,
    ) -> impl Future<Output = EngineResult<()>> + Send;
    fn read_bucket_meta(
        &self,
        bucket_name: &str,
    ) -> impl Future<Output = EngineResult<BucketMeta>> + Send;
    fn delete_bucket_meta(
        &self,
        bucket_name: &str,
    ) -> impl Future<Output = EngineResult<()>> + Send;
    fn list_buckets_meta(
        &self,
    ) -> impl Future<Output = EngineResult<Vec<BucketMeta>>> + Send;
    fn touch_object(
        &self,
        bucket_name: &str,
        object_name: &str,
    ) -> impl Future<Output = EngineResult<()>> + Send;
    fn create_object_meta(
        &self,
        meta: &ObjectMeta,
    ) -> impl Future<Output = EngineResult<()>> + Send;
    fn read_object_meta(
        &self,
        bucket_name: &str,
        object_name: &str,
    ) -> impl Future<Output = EngineResult<ObjectMeta>> + Send;
    fn delete_object_meta(
        &self,
        bucket_name: &str,
        object_name: &str,
    ) -> impl Future<Output = EngineResult<()>> + Send;
    fn list_objects_meta(
        &self,
        bucket_name: &str,
    ) -> impl Future<Output = EngineResult<Vec<ObjectMeta>>> + Send;
    fn touch_bucket(
        &self,
        bucket_name: &str,
    ) -> impl Future<Output = EngineResult<()>> + Send;
}
Expand description

此 trait 定义了 metadata 从何处来,所有的操作,都是幂等的

Required Associated Types§

Required Methods§

Source

fn new<T: AsRef<Self::Uri>>(base_dir: T) -> EngineResult<Self>

Source

fn create_bucket_meta( &self, meta: &BucketMeta, ) -> impl Future<Output = EngineResult<()>> + Send

创建一个新的 Bucket 元数据

Source

fn read_bucket_meta( &self, bucket_name: &str, ) -> impl Future<Output = EngineResult<BucketMeta>> + Send

获取指定 Bucket 的元数据

Source

fn delete_bucket_meta( &self, bucket_name: &str, ) -> impl Future<Output = EngineResult<()>> + Send

删除一个 Bucket 元数据 (要求 Bucket 为空)

Source

fn list_buckets_meta( &self, ) -> impl Future<Output = EngineResult<Vec<BucketMeta>>> + Send

列出所有的 Bucket 的元数据

Source

fn touch_object( &self, bucket_name: &str, object_name: &str, ) -> impl Future<Output = EngineResult<()>> + Send

更新一个 object 的 last_update 字段

Source

fn create_object_meta( &self, meta: &ObjectMeta, ) -> impl Future<Output = EngineResult<()>> + Send

存储(或更新)一个 Object 的元数据

Source

fn read_object_meta( &self, bucket_name: &str, object_name: &str, ) -> impl Future<Output = EngineResult<ObjectMeta>> + Send

获取指定 Object 的元数据

Source

fn delete_object_meta( &self, bucket_name: &str, object_name: &str, ) -> impl Future<Output = EngineResult<()>> + Send

删除一个 Object 的元数据

Source

fn list_objects_meta( &self, bucket_name: &str, ) -> impl Future<Output = EngineResult<Vec<ObjectMeta>>> + Send

列出指定 Bucket 内的所有 Object 元数据

Source

fn touch_bucket( &self, bucket_name: &str, ) -> impl Future<Output = EngineResult<()>> + Send

更新一个 object 的 last_update 字段

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§