refactor: route ecstore public surfaces through api (#3673)

This commit is contained in:
安正超
2026-06-21 05:23:23 +08:00
committed by GitHub
parent 28771f071e
commit 9b3fda9e30
18 changed files with 168 additions and 61 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
# ECStore API Layout
Reserved for facade and compatibility re-export ownership during the ECStore
internal layout migration. No runtime logic lives here yet.
Owns explicit facade and compatibility re-export paths during the ECStore
internal layout migration. No runtime logic lives here.
+49
View File
@@ -0,0 +1,49 @@
// Copyright 2024 RustFS Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Explicit ECStore public facades for outer crate compatibility boundaries.
pub mod admin {
pub use crate::admin_server_info::{get_local_server_property, get_server_info};
}
pub mod capacity {
pub use crate::pools::{
PoolDecommissionInfo, PoolStatus, get_total_usable_capacity, get_total_usable_capacity_free, path2_bucket_object,
path2_bucket_object_with_base_path,
};
pub use crate::store_utils::is_reserved_or_invalid_bucket;
}
pub mod layout {
pub use crate::disks_layout::DisksLayout;
pub use crate::endpoints::{EndpointServerPools, Endpoints, PoolEndpoints};
}
pub mod metrics {
pub use crate::metrics_realtime::{CollectMetricsOpts, MetricType, collect_local_metrics};
}
pub mod notification {
pub use crate::notification_sys::{
NotificationPeerErr, NotificationSys, get_global_notification_sys, new_global_notification_sys,
};
}
pub mod storage {
pub use crate::store::{
ECStore, all_local_disk, all_local_disk_path, find_local_disk_by_ref, init_local_disks, init_lock_clients,
prewarm_local_disk_id_map,
};
}
+1
View File
@@ -16,6 +16,7 @@
extern crate core;
pub mod admin_server_info;
pub mod api;
pub mod batch_processor;
pub mod bitrot;
pub mod bucket;
+1 -1
View File
@@ -18,7 +18,7 @@ pub(crate) const RUSTFS_META_BUCKET: &str = rustfs_ecstore::disk::RUSTFS_META_BU
pub(crate) type DiskError = rustfs_ecstore::disk::error::DiskError;
pub(crate) type DiskStore = rustfs_ecstore::disk::DiskStore;
pub(crate) type ECStore = rustfs_ecstore::store::ECStore;
pub(crate) type ECStore = rustfs_ecstore::api::storage::ECStore;
pub(crate) type EcstoreError = rustfs_ecstore::error::Error;
pub(crate) type Endpoint = rustfs_ecstore::disk::endpoint::Endpoint;
pub(crate) type StorageError = rustfs_ecstore::error::StorageError;
+3 -3
View File
@@ -14,8 +14,8 @@
#![allow(unused_imports)]
pub(crate) use rustfs_ecstore::api::layout::{EndpointServerPools, Endpoints, PoolEndpoints};
pub(crate) use rustfs_ecstore::api::storage::ECStore;
pub(crate) use rustfs_ecstore::api::storage::init_local_disks;
pub(crate) use rustfs_ecstore::bucket::metadata_sys::init_bucket_metadata_sys;
pub(crate) use rustfs_ecstore::disk::{DiskStore, endpoint::Endpoint};
pub(crate) use rustfs_ecstore::endpoints::{EndpointServerPools, Endpoints, PoolEndpoints};
pub(crate) use rustfs_ecstore::store::ECStore;
pub(crate) use rustfs_ecstore::store::init_local_disks;
+11 -11
View File
@@ -19,7 +19,7 @@ pub(crate) const IAM_CONFIG_ROOT_PREFIX: &str = rustfs_ecstore::config::RUSTFS_C
pub(crate) type IamEcstoreError = rustfs_ecstore::error::Error;
pub(crate) type IamStorageError = rustfs_ecstore::error::StorageError;
pub(crate) type IamStorageResult<T> = rustfs_ecstore::error::Result<T>;
pub(crate) type IamStore = rustfs_ecstore::store::ECStore;
pub(crate) type IamStore = rustfs_ecstore::api::storage::ECStore;
pub(crate) type IamConfigObjectInfo = <IamStore as rustfs_storage_api::ObjectOperations>::ObjectInfo;
pub(crate) type IamConfigObjectOptions = <IamStore as rustfs_storage_api::ObjectOperations>::ObjectOptions;
@@ -64,14 +64,14 @@ pub(crate) struct IamNotificationPeerErr {
pub(crate) err: Option<IamEcstoreError>,
}
impl From<rustfs_ecstore::notification_sys::NotificationPeerErr> for IamNotificationPeerErr {
fn from(value: rustfs_ecstore::notification_sys::NotificationPeerErr) -> Self {
impl From<rustfs_ecstore::api::notification::NotificationPeerErr> for IamNotificationPeerErr {
fn from(value: rustfs_ecstore::api::notification::NotificationPeerErr) -> Self {
Self { err: value.err }
}
}
pub(crate) async fn notify_iam_delete_policy(policy_name: &str) -> Vec<IamNotificationPeerErr> {
match rustfs_ecstore::notification_sys::get_global_notification_sys() {
match rustfs_ecstore::api::notification::get_global_notification_sys() {
Some(notification_sys) => notification_sys
.delete_policy(policy_name)
.await
@@ -83,7 +83,7 @@ pub(crate) async fn notify_iam_delete_policy(policy_name: &str) -> Vec<IamNotifi
}
pub(crate) async fn notify_iam_load_policy(policy_name: &str) -> Vec<IamNotificationPeerErr> {
match rustfs_ecstore::notification_sys::get_global_notification_sys() {
match rustfs_ecstore::api::notification::get_global_notification_sys() {
Some(notification_sys) => notification_sys
.load_policy(policy_name)
.await
@@ -95,7 +95,7 @@ pub(crate) async fn notify_iam_load_policy(policy_name: &str) -> Vec<IamNotifica
}
pub(crate) async fn notify_iam_delete_user(access_key: &str) -> Vec<IamNotificationPeerErr> {
match rustfs_ecstore::notification_sys::get_global_notification_sys() {
match rustfs_ecstore::api::notification::get_global_notification_sys() {
Some(notification_sys) => notification_sys
.delete_user(access_key)
.await
@@ -107,7 +107,7 @@ pub(crate) async fn notify_iam_delete_user(access_key: &str) -> Vec<IamNotificat
}
pub(crate) async fn notify_iam_load_user(access_key: &str, temp: bool) -> Vec<IamNotificationPeerErr> {
match rustfs_ecstore::notification_sys::get_global_notification_sys() {
match rustfs_ecstore::api::notification::get_global_notification_sys() {
Some(notification_sys) => notification_sys
.load_user(access_key, temp)
.await
@@ -119,7 +119,7 @@ pub(crate) async fn notify_iam_load_user(access_key: &str, temp: bool) -> Vec<Ia
}
pub(crate) async fn notify_iam_load_service_account(access_key: &str) -> Vec<IamNotificationPeerErr> {
match rustfs_ecstore::notification_sys::get_global_notification_sys() {
match rustfs_ecstore::api::notification::get_global_notification_sys() {
Some(notification_sys) => notification_sys
.load_service_account(access_key)
.await
@@ -131,7 +131,7 @@ pub(crate) async fn notify_iam_load_service_account(access_key: &str) -> Vec<Iam
}
pub(crate) async fn notify_iam_delete_service_account(access_key: &str) -> Vec<IamNotificationPeerErr> {
match rustfs_ecstore::notification_sys::get_global_notification_sys() {
match rustfs_ecstore::api::notification::get_global_notification_sys() {
Some(notification_sys) => notification_sys
.delete_service_account(access_key)
.await
@@ -143,7 +143,7 @@ pub(crate) async fn notify_iam_delete_service_account(access_key: &str) -> Vec<I
}
pub(crate) async fn notify_iam_load_group(group: &str) -> Vec<IamNotificationPeerErr> {
match rustfs_ecstore::notification_sys::get_global_notification_sys() {
match rustfs_ecstore::api::notification::get_global_notification_sys() {
Some(notification_sys) => notification_sys.load_group(group).await.into_iter().map(Into::into).collect(),
None => Vec::new(),
}
@@ -154,7 +154,7 @@ pub(crate) async fn notify_iam_load_policy_mapping(
user_type: u64,
is_group: bool,
) -> Vec<IamNotificationPeerErr> {
match rustfs_ecstore::notification_sys::get_global_notification_sys() {
match rustfs_ecstore::api::notification::get_global_notification_sys() {
Some(notification_sys) => notification_sys
.load_policy_mapping(user_or_group, user_type, is_group)
.await
+9 -3
View File
@@ -22,7 +22,7 @@ use std::time::Duration;
pub(crate) use rustfs_ecstore::data_usage::load_data_usage_from_backend as load_obs_data_usage_from_backend;
pub(crate) type ObsStore = rustfs_ecstore::store::ECStore;
pub(crate) type ObsStore = rustfs_ecstore::api::storage::ECStore;
type ObsStorageInfo = <ObsStore as StorageAdminApi>::StorageInfo;
#[derive(Debug, Clone, PartialEq)]
@@ -50,11 +50,17 @@ pub(crate) fn resolve_obs_object_store_handle() -> Option<Arc<ObsStore>> {
}
pub(crate) fn obs_total_usable_capacity_bytes(storage_info: &ObsStorageInfo) -> u64 {
usize_to_u64_saturating(rustfs_ecstore::pools::get_total_usable_capacity(&storage_info.disks, storage_info))
usize_to_u64_saturating(rustfs_ecstore::api::capacity::get_total_usable_capacity(
&storage_info.disks,
storage_info,
))
}
pub(crate) fn obs_total_usable_capacity_free_bytes(storage_info: &ObsStorageInfo) -> u64 {
usize_to_u64_saturating(rustfs_ecstore::pools::get_total_usable_capacity_free(&storage_info.disks, storage_info))
usize_to_u64_saturating(rustfs_ecstore::api::capacity::get_total_usable_capacity_free(
&storage_info.disks,
storage_info,
))
}
pub(crate) async fn obs_bucket_quota_limit_bytes(bucket: &str) -> u64 {
+1 -1
View File
@@ -16,7 +16,7 @@ use std::sync::Arc;
pub(super) type SwiftBucketMetadata = rustfs_ecstore::bucket::metadata::BucketMetadata;
pub(super) type SwiftStorageResult<T> = rustfs_ecstore::error::Result<T>;
pub(super) type SwiftStore = rustfs_ecstore::store::ECStore;
pub(super) type SwiftStore = rustfs_ecstore::api::storage::ECStore;
pub type SwiftGetObjectReader = <SwiftStore as rustfs_storage_api::ObjectIO>::GetObjectReader;
pub type SwiftObjectInfo = <SwiftStore as rustfs_storage_api::ObjectOperations>::ObjectInfo;
pub type SwiftObjectOptions = <SwiftStore as rustfs_storage_api::ObjectOperations>::ObjectOptions;
+1 -1
View File
@@ -13,7 +13,7 @@
// limitations under the License.
pub(crate) type SelectStorageError = rustfs_ecstore::error::StorageError;
pub(crate) type SelectStore = rustfs_ecstore::store::ECStore;
pub(crate) type SelectStore = rustfs_ecstore::api::storage::ECStore;
pub(crate) type SelectGetObjectReader = <SelectStore as rustfs_storage_api::ObjectIO>::GetObjectReader;
pub(crate) type SelectObjectInfo = <SelectStore as rustfs_storage_api::ObjectOperations>::ObjectInfo;
pub(crate) type SelectObjectOptions = <SelectStore as rustfs_storage_api::ObjectOperations>::ObjectOptions;
+4 -4
View File
@@ -24,7 +24,7 @@ pub(crate) const TRANSITION_COMPLETE: &str = rustfs_ecstore::bucket::lifecycle::
pub(crate) type Disk = rustfs_ecstore::disk::Disk;
pub(crate) type DiskError = rustfs_ecstore::disk::error::DiskError;
pub(crate) type ECStore = rustfs_ecstore::store::ECStore;
pub(crate) type ECStore = rustfs_ecstore::api::storage::ECStore;
pub(crate) type EcstoreError = rustfs_ecstore::error::Error;
pub(crate) type EcstoreResult<T> = rustfs_ecstore::error::Result<T>;
pub(crate) type ListPathRawOptions = rustfs_ecstore::cache_value::metacache_set::ListPathRawOptions;
@@ -69,15 +69,15 @@ pub(crate) fn resolve_scanner_object_store_handle() -> Option<Arc<ECStore>> {
}
pub(crate) fn is_reserved_or_invalid_bucket(bucket: &str, strict: bool) -> bool {
rustfs_ecstore::store_utils::is_reserved_or_invalid_bucket(bucket, strict)
rustfs_ecstore::api::capacity::is_reserved_or_invalid_bucket(bucket, strict)
}
pub(crate) fn path2_bucket_object(name: &str) -> (String, String) {
rustfs_ecstore::pools::path2_bucket_object(name)
rustfs_ecstore::api::capacity::path2_bucket_object(name)
}
pub(crate) fn path2_bucket_object_with_base_path(base_path: &str, path: &str) -> (String, String) {
rustfs_ecstore::pools::path2_bucket_object_with_base_path(base_path, path)
rustfs_ecstore::api::capacity::path2_bucket_object_with_base_path(base_path, path)
}
pub(crate) async fn is_erasure() -> bool {
@@ -19,6 +19,10 @@ pub(crate) const STORAGE_FORMAT_FILE: &str = rustfs_ecstore::disk::STORAGE_FORMA
pub(crate) type TransitionOptions = rustfs_ecstore::bucket::lifecycle::lifecycle::TransitionOptions;
pub(crate) use rustfs_ecstore::api::capacity::path2_bucket_object_with_base_path;
pub(crate) use rustfs_ecstore::api::layout::{EndpointServerPools, Endpoints, PoolEndpoints};
pub(crate) use rustfs_ecstore::api::storage::ECStore;
pub(crate) use rustfs_ecstore::api::storage::init_local_disks;
pub(crate) use rustfs_ecstore::bucket::lifecycle::bucket_lifecycle_ops::{
enqueue_transition_for_existing_objects, init_background_expiry,
};
@@ -28,11 +32,7 @@ pub(crate) use rustfs_ecstore::bucket::metadata_sys::{
pub(crate) use rustfs_ecstore::bucket::versioning_sys::BucketVersioningSys;
pub(crate) use rustfs_ecstore::client::transition_api::{ReadCloser, ReaderImpl};
pub(crate) use rustfs_ecstore::disk::{DiskAPI, DiskOption, endpoint::Endpoint, new_disk};
pub(crate) use rustfs_ecstore::endpoints::{EndpointServerPools, Endpoints, PoolEndpoints};
pub(crate) use rustfs_ecstore::global::GLOBAL_TierConfigMgr;
pub(crate) use rustfs_ecstore::pools::path2_bucket_object_with_base_path;
pub(crate) use rustfs_ecstore::store::ECStore;
pub(crate) use rustfs_ecstore::store::init_local_disks;
pub(crate) use rustfs_ecstore::tier::tier_config::{TierConfig, TierMinIO, TierType};
pub(crate) use rustfs_ecstore::tier::warm_backend::WarmBackendGetOpts;
pub(crate) use rustfs_ecstore::tier::warm_backend::{WarmBackend, build_transition_put_options};