refactor: prune consumer storage compat paths (#3704)

This commit is contained in:
安正超
2026-06-22 02:31:30 +08:00
committed by GitHub
parent e528ee9452
commit d39815470e
14 changed files with 280 additions and 196 deletions
+40 -41
View File
@@ -16,31 +16,36 @@
use std::collections::HashMap;
use std::sync::Arc;
use rustfs_ecstore::api::{
bucket as ecstore_bucket, capacity as ecstore_capacity, client as ecstore_client, disk as ecstore_disk,
error as ecstore_error, global as ecstore_global, layout as ecstore_layout, storage as ecstore_storage, tier as ecstore_tier,
};
use time::OffsetDateTime;
pub(crate) const BUCKET_LIFECYCLE_CONFIG: &str = rustfs_ecstore::api::bucket::metadata::BUCKET_LIFECYCLE_CONFIG;
pub(crate) const STORAGE_FORMAT_FILE: &str = rustfs_ecstore::api::disk::STORAGE_FORMAT_FILE;
pub(crate) const BUCKET_LIFECYCLE_CONFIG: &str = ecstore_bucket::metadata::BUCKET_LIFECYCLE_CONFIG;
pub(crate) const STORAGE_FORMAT_FILE: &str = ecstore_disk::STORAGE_FORMAT_FILE;
pub(crate) type BucketMetadata = rustfs_ecstore::api::bucket::metadata::BucketMetadata;
pub(crate) type BucketVersioningSys = rustfs_ecstore::api::bucket::versioning_sys::BucketVersioningSys;
pub(crate) type DiskOption = rustfs_ecstore::api::disk::DiskOption;
pub(crate) type ECStore = rustfs_ecstore::api::storage::ECStore;
pub(crate) type Endpoint = rustfs_ecstore::api::disk::endpoint::Endpoint;
pub(crate) type EndpointServerPools = rustfs_ecstore::api::layout::EndpointServerPools;
pub(crate) type Endpoints = rustfs_ecstore::api::layout::Endpoints;
pub(crate) type PoolEndpoints = rustfs_ecstore::api::layout::PoolEndpoints;
pub(crate) type ReadCloser = rustfs_ecstore::api::client::transition_api::ReadCloser;
pub(crate) type ReaderImpl = rustfs_ecstore::api::client::transition_api::ReaderImpl;
pub(crate) type TierConfig = rustfs_ecstore::api::tier::tier_config::TierConfig;
pub(crate) type TierConfigMgr = rustfs_ecstore::api::tier::tier::TierConfigMgr;
pub(crate) type TierMinIO = rustfs_ecstore::api::tier::tier_config::TierMinIO;
pub(crate) type TierType = rustfs_ecstore::api::tier::tier_config::TierType;
pub(crate) type TransitionOptions = rustfs_ecstore::api::bucket::lifecycle::lifecycle::TransitionOptions;
pub(crate) type WarmBackendGetOpts = rustfs_ecstore::api::tier::warm_backend::WarmBackendGetOpts;
pub(crate) type BucketMetadata = ecstore_bucket::metadata::BucketMetadata;
pub(crate) type BucketVersioningSys = ecstore_bucket::versioning_sys::BucketVersioningSys;
pub(crate) type DiskOption = ecstore_disk::DiskOption;
pub(crate) type ECStore = ecstore_storage::ECStore;
pub(crate) type Endpoint = ecstore_disk::endpoint::Endpoint;
pub(crate) type EndpointServerPools = ecstore_layout::EndpointServerPools;
pub(crate) type Endpoints = ecstore_layout::Endpoints;
pub(crate) type PoolEndpoints = ecstore_layout::PoolEndpoints;
pub(crate) type ReadCloser = ecstore_client::transition_api::ReadCloser;
pub(crate) type ReaderImpl = ecstore_client::transition_api::ReaderImpl;
pub(crate) type TierConfig = ecstore_tier::tier_config::TierConfig;
pub(crate) type TierConfigMgr = ecstore_tier::tier::TierConfigMgr;
pub(crate) type TierMinIO = ecstore_tier::tier_config::TierMinIO;
pub(crate) type TierType = ecstore_tier::tier_config::TierType;
pub(crate) type TransitionOptions = ecstore_bucket::lifecycle::lifecycle::TransitionOptions;
pub(crate) type WarmBackendGetOpts = ecstore_tier::warm_backend::WarmBackendGetOpts;
#[allow(non_snake_case)]
pub(crate) fn EndpointServerPools(pools: Vec<PoolEndpoints>) -> EndpointServerPools {
rustfs_ecstore::api::layout::EndpointServerPools::from(pools)
ecstore_layout::EndpointServerPools::from(pools)
}
pub(crate) struct GlobalTierConfigMgrCompat;
@@ -52,55 +57,49 @@ impl std::ops::Deref for GlobalTierConfigMgrCompat {
type Target = Arc<tokio::sync::RwLock<TierConfigMgr>>;
fn deref(&self) -> &Self::Target {
&rustfs_ecstore::api::global::GLOBAL_TierConfigMgr
&ecstore_global::GLOBAL_TierConfigMgr
}
}
pub(crate) fn build_transition_put_options(
storage_class: String,
metadata: HashMap<String, String>,
) -> rustfs_ecstore::api::client::api_put_object::PutObjectOptions {
rustfs_ecstore::api::tier::warm_backend::build_transition_put_options(storage_class, metadata)
) -> ecstore_client::api_put_object::PutObjectOptions {
ecstore_tier::warm_backend::build_transition_put_options(storage_class, metadata)
}
pub(crate) async fn enqueue_transition_for_existing_objects(
api: Arc<ECStore>,
bucket: &str,
) -> rustfs_ecstore::api::error::Result<()> {
rustfs_ecstore::api::bucket::lifecycle::bucket_lifecycle_ops::enqueue_transition_for_existing_objects(api, bucket).await
pub(crate) async fn enqueue_transition_for_existing_objects(api: Arc<ECStore>, bucket: &str) -> ecstore_error::Result<()> {
ecstore_bucket::lifecycle::bucket_lifecycle_ops::enqueue_transition_for_existing_objects(api, bucket).await
}
pub(crate) async fn init_background_expiry(api: Arc<ECStore>) {
rustfs_ecstore::api::bucket::lifecycle::bucket_lifecycle_ops::init_background_expiry(api).await;
ecstore_bucket::lifecycle::bucket_lifecycle_ops::init_background_expiry(api).await;
}
pub(crate) async fn get_bucket_metadata(bucket: &str) -> rustfs_ecstore::api::error::Result<Arc<BucketMetadata>> {
rustfs_ecstore::api::bucket::metadata_sys::get(bucket).await
pub(crate) async fn get_bucket_metadata(bucket: &str) -> ecstore_error::Result<Arc<BucketMetadata>> {
ecstore_bucket::metadata_sys::get(bucket).await
}
pub(crate) async fn init_bucket_metadata_sys(api: Arc<ECStore>, buckets: Vec<String>) {
rustfs_ecstore::api::bucket::metadata_sys::init_bucket_metadata_sys(api, buckets).await;
ecstore_bucket::metadata_sys::init_bucket_metadata_sys(api, buckets).await;
}
pub(crate) async fn init_local_disks(endpoint_pools: EndpointServerPools) -> rustfs_ecstore::api::error::Result<()> {
rustfs_ecstore::api::storage::init_local_disks(endpoint_pools).await
pub(crate) async fn init_local_disks(endpoint_pools: EndpointServerPools) -> ecstore_error::Result<()> {
ecstore_storage::init_local_disks(endpoint_pools).await
}
pub(crate) async fn new_disk(
ep: &Endpoint,
opt: &DiskOption,
) -> rustfs_ecstore::api::disk::error::Result<rustfs_ecstore::api::disk::DiskStore> {
rustfs_ecstore::api::disk::new_disk(ep, opt).await
pub(crate) async fn new_disk(ep: &Endpoint, opt: &DiskOption) -> ecstore_disk::error::Result<ecstore_disk::DiskStore> {
ecstore_disk::new_disk(ep, opt).await
}
pub(crate) fn path2_bucket_object_with_base_path(base_path: &str, path: &str) -> (String, String) {
rustfs_ecstore::api::capacity::path2_bucket_object_with_base_path(base_path, path)
ecstore_capacity::path2_bucket_object_with_base_path(base_path, path)
}
pub(crate) async fn update_bucket_metadata(
bucket: &str,
config_file: &str,
data: Vec<u8>,
) -> rustfs_ecstore::api::error::Result<OffsetDateTime> {
rustfs_ecstore::api::bucket::metadata_sys::update(bucket, config_file, data).await
) -> ecstore_error::Result<OffsetDateTime> {
ecstore_bucket::metadata_sys::update(bucket, config_file, data).await
}