init metacache io

This commit is contained in:
weisd
2024-12-05 17:42:17 +08:00
committed by weisd
parent 2786174ffb
commit 0cf7c19b96
4 changed files with 30 additions and 32 deletions

View File

@@ -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;

View File

@@ -1016,32 +1016,32 @@ pub struct PoolObjInfo {
pub err: Option<Error>,
}
#[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<ListObjectsV2Info> {
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 {

View File

@@ -151,7 +151,7 @@ impl ECStore {
todo!()
}
async fn list_path(&self, o: &ListPathOptions) -> Result<ListObjectsInfo> {
pub async fn list_path(&self, o: &ListPathOptions) -> Result<ListObjectsInfo> {
check_list_objs_args(&o.bucket, &o.prefix, &o.marker)?;
// if opts.prefix.ends_with(SLASH_SEPARATOR) {
// return Err(Error::msg("eof"));

View File

@@ -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 {