From 0cf7c19b96a69424d2cd5b047ca50ec87445d572 Mon Sep 17 00:00:00 2001 From: weisd Date: Thu, 5 Dec 2024 17:42:17 +0800 Subject: [PATCH] init metacache io --- ecstore/src/lib.rs | 2 +- ecstore/src/store.rs | 42 +++++++++++++++---------------- ecstore/src/store_list_objects.rs | 2 +- iam/src/store/object.rs | 16 ++++++------ 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/ecstore/src/lib.rs b/ecstore/src/lib.rs index ddd417b6e..642ab1525 100644 --- a/ecstore/src/lib.rs +++ b/ecstore/src/lib.rs @@ -25,7 +25,7 @@ pub mod store; pub mod store_api; pub mod store_err; mod store_init; -mod store_list_objects; +pub mod store_list_objects; pub mod utils; pub mod xhttp; diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index e583545d2..cfaedd03e 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -1016,32 +1016,32 @@ pub struct PoolObjInfo { pub err: Option, } -#[derive(Debug, Default, Clone)] -pub struct ListPathOptions { - pub id: String, +// #[derive(Debug, Default, Clone)] +// pub struct ListPathOptions { +// pub id: String, - // Bucket of the listing. - pub bucket: String, +// // Bucket of the listing. +// pub bucket: String, - // Directory inside the bucket. - // When unset listPath will set this based on Prefix - pub base_dir: String, +// // Directory inside the bucket. +// // When unset listPath will set this based on Prefix +// pub base_dir: String, - // Scan/return only content with prefix. - pub prefix: String, +// // Scan/return only content with prefix. +// pub prefix: String, - // FilterPrefix will return only results with this prefix when scanning. - // Should never contain a slash. - // Prefix should still be set. - pub filter_prefix: String, +// // FilterPrefix will return only results with this prefix when scanning. +// // Should never contain a slash. +// // Prefix should still be set. +// pub filter_prefix: String, - // Marker to resume listing. - // The response will be the first entry >= this object name. - pub marker: String, +// // Marker to resume listing. +// // The response will be the first entry >= this object name. +// pub marker: String, - // Limit the number of results. - pub limit: i32, -} +// // Limit the number of results. +// pub limit: i32, +// } #[async_trait::async_trait] impl ObjectIO for ECStore { @@ -1521,7 +1521,7 @@ impl StorageAPI for ECStore { fetch_owner: bool, start_after: &str, ) -> Result { - self.inner_list_objects_v2(&bucket, &prefix, &continuation_token, &delimiter, max_keys, fetch_owner, start_after) + self.inner_list_objects_v2(bucket, prefix, continuation_token, delimiter, max_keys, fetch_owner, start_after) .await // let opts = ListPathOptions { diff --git a/ecstore/src/store_list_objects.rs b/ecstore/src/store_list_objects.rs index 119cb738f..5ff4586f1 100644 --- a/ecstore/src/store_list_objects.rs +++ b/ecstore/src/store_list_objects.rs @@ -151,7 +151,7 @@ impl ECStore { todo!() } - async fn list_path(&self, o: &ListPathOptions) -> Result { + pub async fn list_path(&self, o: &ListPathOptions) -> Result { check_list_objs_args(&o.bucket, &o.prefix, &o.marker)?; // if opts.prefix.ends_with(SLASH_SEPARATOR) { // return Err(Error::msg("eof")); diff --git a/iam/src/store/object.rs b/iam/src/store/object.rs index 57c00ec26..230259668 100644 --- a/iam/src/store/object.rs +++ b/iam/src/store/object.rs @@ -2,8 +2,9 @@ use std::{collections::HashMap, path::Path, sync::Arc}; use ecstore::{ config::error::is_not_found, - store::{ECStore, ListPathOptions}, + store::ECStore, store_api::{HTTPRangeSpec, ObjectIO, ObjectInfo, ObjectOptions, PutObjReader}, + store_list_objects::ListPathOptions, utils::path::dir, }; use futures::future::try_join_all; @@ -42,14 +43,11 @@ impl ObjectStore { futures.push(async move { let items = self .object_api - .list_path( - &ListPathOptions { - bucket: Self::BUCKET_NAME.into(), - prefix: prefix.clone(), - ..Default::default() - }, - "", - ) + .list_path(&ListPathOptions { + bucket: Self::BUCKET_NAME.into(), + prefix: prefix.clone(), + ..Default::default() + }) .await; match items {