mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-08 14:23:13 +00:00
refactor: prune edge compat aliases (#3692)
This commit is contained in:
@@ -19,6 +19,27 @@ pub(crate) type TonicInterceptor = rustfs_ecstore::api::rpc::TonicInterceptor;
|
||||
pub(crate) type VolumeInfo = rustfs_ecstore::api::disk::VolumeInfo;
|
||||
pub(crate) type WalkDirOptions = rustfs_ecstore::api::disk::WalkDirOptions;
|
||||
|
||||
pub(crate) use rustfs_ecstore::api::rpc::{
|
||||
gen_tonic_signature_interceptor, node_service_time_out_client, node_service_time_out_client_no_auth,
|
||||
};
|
||||
pub(crate) use rustfs_ecstore::api::rpc::gen_tonic_signature_interceptor;
|
||||
|
||||
pub(crate) async fn node_service_time_out_client(
|
||||
addr: &String,
|
||||
interceptor: TonicInterceptor,
|
||||
) -> Result<
|
||||
rustfs_protos::proto_gen::node_service::node_service_client::NodeServiceClient<
|
||||
tonic::service::interceptor::InterceptedService<tonic::transport::Channel, TonicInterceptor>,
|
||||
>,
|
||||
Box<dyn std::error::Error>,
|
||||
> {
|
||||
rustfs_ecstore::api::rpc::node_service_time_out_client(addr, interceptor).await
|
||||
}
|
||||
|
||||
pub(crate) async fn node_service_time_out_client_no_auth(
|
||||
addr: &String,
|
||||
) -> Result<
|
||||
rustfs_protos::proto_gen::node_service::node_service_client::NodeServiceClient<
|
||||
tonic::service::interceptor::InterceptedService<tonic::transport::Channel, TonicInterceptor>,
|
||||
>,
|
||||
Box<dyn std::error::Error>,
|
||||
> {
|
||||
rustfs_ecstore::api::rpc::node_service_time_out_client_no_auth(addr).await
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
// limitations under the License.
|
||||
|
||||
use rustfs_config::server_config::Config;
|
||||
use rustfs_ecstore::api::{config, global};
|
||||
use std::sync::Arc;
|
||||
|
||||
type NotifyStore = rustfs_ecstore::api::storage::ECStore;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum NotifyConfigStoreError {
|
||||
@@ -26,21 +28,33 @@ pub(crate) async fn update_server_config<F>(mut modifier: F) -> Result<Option<Co
|
||||
where
|
||||
F: FnMut(&mut Config) -> bool,
|
||||
{
|
||||
let Some(store) = global::resolve_object_store_handle() else {
|
||||
let Some(store) = resolve_notify_object_store_handle() else {
|
||||
return Err(NotifyConfigStoreError::StorageNotAvailable);
|
||||
};
|
||||
|
||||
let mut new_config = config::com::read_config_without_migrate(store.clone())
|
||||
.await
|
||||
.map_err(|err| NotifyConfigStoreError::Read(err.to_string()))?;
|
||||
let mut new_config = read_notify_server_config_without_migrate(store.clone()).await?;
|
||||
|
||||
if !modifier(&mut new_config) {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
config::com::save_server_config(store, &new_config)
|
||||
.await
|
||||
.map_err(|err| NotifyConfigStoreError::Save(err.to_string()))?;
|
||||
save_notify_server_config(store, &new_config).await?;
|
||||
|
||||
Ok(Some(new_config))
|
||||
}
|
||||
|
||||
fn resolve_notify_object_store_handle() -> Option<Arc<NotifyStore>> {
|
||||
rustfs_ecstore::api::global::resolve_object_store_handle()
|
||||
}
|
||||
|
||||
async fn read_notify_server_config_without_migrate(store: Arc<NotifyStore>) -> Result<Config, NotifyConfigStoreError> {
|
||||
rustfs_ecstore::api::config::com::read_config_without_migrate(store)
|
||||
.await
|
||||
.map_err(|err| NotifyConfigStoreError::Read(err.to_string()))
|
||||
}
|
||||
|
||||
async fn save_notify_server_config(store: Arc<NotifyStore>, config: &Config) -> Result<(), NotifyConfigStoreError> {
|
||||
rustfs_ecstore::api::config::com::save_server_config(store, config)
|
||||
.await
|
||||
.map_err(|err| NotifyConfigStoreError::Save(err.to_string()))
|
||||
}
|
||||
|
||||
@@ -17,14 +17,62 @@ use crate::metrics::collectors::{
|
||||
ReplicationStats as MetricReplicationStats,
|
||||
};
|
||||
use rustfs_storage_api::StorageAdminApi;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
pub(crate) use rustfs_ecstore::api::data_usage::load_data_usage_from_backend as load_obs_data_usage_from_backend;
|
||||
|
||||
pub(crate) type ObsStore = rustfs_ecstore::api::storage::ECStore;
|
||||
type ObsStorageInfo = <ObsStore as StorageAdminApi>::StorageInfo;
|
||||
|
||||
pub(crate) struct ObsDataUsageInfo {
|
||||
pub(crate) buckets_count: u64,
|
||||
pub(crate) objects_total_count: u64,
|
||||
pub(crate) versions_total_count: u64,
|
||||
pub(crate) delete_markers_total_count: u64,
|
||||
pub(crate) objects_total_size: u64,
|
||||
pub(crate) buckets_usage: HashMap<String, ObsBucketUsageInfo>,
|
||||
}
|
||||
|
||||
pub(crate) struct ObsBucketUsageInfo {
|
||||
pub(crate) size: u64,
|
||||
pub(crate) objects_count: u64,
|
||||
pub(crate) object_size_histogram: HashMap<String, u64>,
|
||||
pub(crate) object_versions_histogram: HashMap<String, u64>,
|
||||
pub(crate) versions_count: u64,
|
||||
pub(crate) delete_markers_count: u64,
|
||||
}
|
||||
|
||||
pub(crate) async fn load_obs_data_usage_from_backend(
|
||||
store: Arc<ObsStore>,
|
||||
) -> rustfs_ecstore::api::error::Result<ObsDataUsageInfo> {
|
||||
let data_usage = rustfs_ecstore::api::data_usage::load_data_usage_from_backend(store).await?;
|
||||
|
||||
Ok(ObsDataUsageInfo {
|
||||
buckets_count: data_usage.buckets_count,
|
||||
objects_total_count: data_usage.objects_total_count,
|
||||
versions_total_count: data_usage.versions_total_count,
|
||||
delete_markers_total_count: data_usage.delete_markers_total_count,
|
||||
objects_total_size: data_usage.objects_total_size,
|
||||
buckets_usage: data_usage
|
||||
.buckets_usage
|
||||
.into_iter()
|
||||
.map(|(bucket, usage)| {
|
||||
(
|
||||
bucket,
|
||||
ObsBucketUsageInfo {
|
||||
size: usage.size,
|
||||
objects_count: usage.objects_count,
|
||||
object_size_histogram: usage.object_size_histogram,
|
||||
object_versions_histogram: usage.object_versions_histogram,
|
||||
versions_count: usage.versions_count,
|
||||
delete_markers_count: usage.delete_markers_count,
|
||||
},
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub(crate) struct ObsBucketReplicationBandwidthStats {
|
||||
pub(crate) bucket: String,
|
||||
|
||||
@@ -31,19 +31,21 @@ pub(crate) type ListPathRawOptions = rustfs_ecstore::api::cache::ListPathRawOpti
|
||||
pub(crate) type SetDisks = rustfs_ecstore::api::set_disk::SetDisks;
|
||||
pub(crate) type StorageError = rustfs_ecstore::api::error::StorageError;
|
||||
|
||||
pub(crate) use rustfs_ecstore::api::bucket::{
|
||||
bucket_target_sys::BucketTargetSys,
|
||||
lifecycle::{
|
||||
bucket_lifecycle_audit::LcEventSrc,
|
||||
bucket_lifecycle_ops::{GLOBAL_ExpiryState, apply_expiry_rule, apply_transition_rule},
|
||||
evaluator::Evaluator,
|
||||
lifecycle::{Event, Lifecycle, ObjectOpts},
|
||||
},
|
||||
metadata_sys::{get_lifecycle_config, get_object_lock_config, get_replication_config},
|
||||
replication::{ReplicationConfig, ReplicationConfigurationExt, ReplicationQueueAdmission, queue_replication_heal_internal},
|
||||
versioning::VersioningApi,
|
||||
versioning_sys::BucketVersioningSys,
|
||||
pub(crate) use rustfs_ecstore::api::bucket::bucket_target_sys::BucketTargetSys;
|
||||
pub(crate) use rustfs_ecstore::api::bucket::lifecycle::bucket_lifecycle_audit::LcEventSrc;
|
||||
pub(crate) use rustfs_ecstore::api::bucket::lifecycle::bucket_lifecycle_ops::{
|
||||
GLOBAL_ExpiryState, apply_expiry_rule, apply_transition_rule,
|
||||
};
|
||||
pub(crate) use rustfs_ecstore::api::bucket::lifecycle::evaluator::Evaluator;
|
||||
pub(crate) use rustfs_ecstore::api::bucket::lifecycle::lifecycle::{Event, Lifecycle, ObjectOpts};
|
||||
pub(crate) use rustfs_ecstore::api::bucket::metadata_sys::{
|
||||
get_lifecycle_config, get_object_lock_config, get_replication_config,
|
||||
};
|
||||
pub(crate) use rustfs_ecstore::api::bucket::replication::{
|
||||
ReplicationConfig, ReplicationConfigurationExt, ReplicationQueueAdmission, queue_replication_heal_internal,
|
||||
};
|
||||
pub(crate) use rustfs_ecstore::api::bucket::versioning::VersioningApi;
|
||||
pub(crate) use rustfs_ecstore::api::bucket::versioning_sys::BucketVersioningSys;
|
||||
pub(crate) use rustfs_ecstore::api::disk::{DiskAPI, DiskInfoOptions};
|
||||
pub(crate) use rustfs_ecstore::api::global::GLOBAL_TierConfigMgr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user