refactor: route RustFS ECStore consumers via owner boundary (#3745)

This commit is contained in:
Zhengchao An
2026-06-22 19:29:01 +08:00
committed by GitHub
parent a53ccb2407
commit 89805ffb4d
26 changed files with 102 additions and 69 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use rustfs_ecstore::api::{disk as ecstore_disk, storage as ecstore_storage};
use crate::storage::{ecstore_disk, ecstore_storage};
use rustfs_io_metrics::capacity_metrics::{
record_capacity_cache_hit, record_capacity_cache_miss, record_capacity_cache_served, record_capacity_refresh_request,
record_capacity_scan_mode,
+2 -2
View File
@@ -16,9 +16,9 @@
#[allow(unsafe_op_in_unsafe_fn)]
mod tests {
use crate::config::{CommandResult, Config, Opt, TlsCommands};
use crate::storage::ecstore_layout::DisksLayout;
use rustfs_config::{DEFAULT_CONSOLE_ADDRESS, DEFAULT_CONSOLE_ENABLE, DEFAULT_OBS_ENDPOINT, RUSTFS_REGION};
use rustfs_credentials::{DEFAULT_ACCESS_KEY, DEFAULT_SECRET_KEY};
use rustfs_ecstore::api::layout::DisksLayout;
use serial_test::serial;
use std::env;
@@ -262,7 +262,7 @@ mod tests {
#[test]
#[serial]
fn test_volumes_and_disk_layout_parsing() {
use rustfs_ecstore::api::layout::DisksLayout;
use crate::storage::ecstore_layout::DisksLayout;
// Test case 1: Single volume path
let args = vec!["rustfs", "/data/vol1"];
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use rustfs_ecstore::api::{bucket::quota::QuotaError, error::StorageError};
use crate::storage::{ecstore_bucket::quota::QuotaError, ecstore_error::StorageError};
use rustfs_storage_api::HTTPRangeError;
use s3s::{S3Error, S3ErrorCode};
+1 -1
View File
@@ -13,13 +13,13 @@
// limitations under the License.
use crate::server::ShutdownHandle;
use crate::storage::{ecstore_bucket::metadata_sys as ecstore_metadata_sys, ecstore_global};
use crate::storage::{process_lambda_configurations, process_queue_configurations, process_topic_configurations};
use crate::{admin, config, version};
use rustfs_config::{
DEFAULT_BUFFER_MAX_SIZE, DEFAULT_BUFFER_MIN_SIZE, DEFAULT_BUFFER_PROFILE, DEFAULT_BUFFER_UNKNOWN_SIZE, DEFAULT_UPDATE_CHECK,
ENV_RUSTFS_BUFFER_DEFAULT_SIZE, ENV_RUSTFS_BUFFER_MAX_SIZE, ENV_RUSTFS_BUFFER_MIN_SIZE, ENV_UPDATE_CHECK, RUSTFS_REGION,
};
use rustfs_ecstore::api::{bucket::metadata_sys as ecstore_metadata_sys, global as ecstore_global};
use rustfs_notify::notifier_global;
use rustfs_targets::arn::{ARN, TargetIDError};
use rustfs_utils::get_env_usize;
+4 -4
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use rustfs_ecstore::api::{cluster as ecstore_cluster, layout::EndpointServerPools};
use crate::storage::{ecstore_cluster, ecstore_layout::EndpointServerPools};
use rustfs_storage_api::{
CapabilitySnapshotError, CapabilityStatus, DiskCapabilities, MemorySamplingState, ObservabilitySnapshot,
ObservabilitySnapshotProvider, PlatformSupport, TopologyCapabilities, TopologySnapshot, TopologySnapshotProvider,
@@ -131,9 +131,9 @@ fn cgroup_memory_status() -> CapabilityStatus {
#[cfg(test)]
mod tests {
use super::*;
use rustfs_ecstore::api::{
disk::endpoint::Endpoint,
layout::{Endpoints, PoolEndpoints},
use crate::storage::{
ecstore_disk::endpoint::Endpoint,
ecstore_layout::{Endpoints, PoolEndpoints},
};
use rustfs_storage_api::{CapabilityState, ObservabilitySnapshotProvider, TopologySnapshotProvider};
+1 -1
View File
@@ -15,8 +15,8 @@
use super::{module_switch::resolve_notify_module_state, refresh_persisted_module_switches_from_store};
use crate::app::context::resolve_server_config;
use crate::storage::StorageObjectInfo;
use crate::storage::ecstore_event::{EventArgs as EcstoreEventArgs, register_event_dispatch_hook};
use chrono::{DateTime, Utc};
use rustfs_ecstore::api::event::{EventArgs as EcstoreEventArgs, register_event_dispatch_hook};
use rustfs_notify::{EventArgs as NotifyEventArgs, NotifyObjectInfo};
use rustfs_s3_types::EventName;
use std::net::SocketAddr;
+1 -1
View File
@@ -31,6 +31,7 @@ use crate::server::{
},
};
use crate::storage;
use crate::storage::ecstore_rpc::{TONIC_RPC_PREFIX, verify_rpc_signature};
use crate::storage::rpc::InternodeRpcService;
use crate::storage::tonic_service::make_server;
use bytes::Bytes;
@@ -45,7 +46,6 @@ use metrics::{counter, gauge, histogram};
use opentelemetry::global;
use opentelemetry::trace::TraceContextExt;
use rustfs_common::GlobalReadiness;
use rustfs_ecstore::api::rpc::{TONIC_RPC_PREFIX, verify_rpc_signature};
use rustfs_keystone::KeystoneAuthLayer;
#[cfg(feature = "swift")]
use rustfs_protocols::SwiftService;
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use rustfs_ecstore::api::{config as ecstore_config, error::Error as StorageError, global::resolve_object_store_handle};
use crate::storage::{ecstore_config, ecstore_error::Error as StorageError, ecstore_global::resolve_object_store_handle};
use serde::{Deserialize, Serialize};
use std::sync::atomic::{AtomicBool, Ordering};
+7 -7
View File
@@ -14,6 +14,13 @@
use crate::server::{ServiceState, ServiceStateManager};
use crate::server::{has_path_prefix, is_table_catalog_path};
#[cfg(test)]
use crate::storage::ecstore_layout::{Endpoints, PoolEndpoints};
use crate::storage::{
ecstore_disk::endpoint::Endpoint,
ecstore_global::{get_global_endpoints_opt, get_global_lock_clients, is_dist_erasure, resolve_object_store_handle},
ecstore_layout::EndpointServerPools,
};
use bytes::Bytes;
use http::{Request as HttpRequest, Response, StatusCode};
use http_body::Body;
@@ -21,13 +28,6 @@ use http_body_util::{BodyExt, Full};
use hyper::body::Incoming;
use metrics::{counter, gauge};
use rustfs_common::GlobalReadiness;
#[cfg(test)]
use rustfs_ecstore::api::layout::{Endpoints, PoolEndpoints};
use rustfs_ecstore::api::{
disk::endpoint::Endpoint,
global::{get_global_endpoints_opt, get_global_lock_clients, is_dist_erasure, resolve_object_store_handle},
layout::EndpointServerPools,
};
use rustfs_iam::get_global_iam_sys;
use rustfs_madmin::{Disk, StorageInfo};
use rustfs_storage_api::StorageAdminApi;
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use rustfs_ecstore::api::storage::ECStore;
use crate::storage::ECStore;
use rustfs_heal::{create_ahm_services_cancel_token, heal::storage::ECStoreHealStorage, init_heal_manager};
use rustfs_utils::get_env_bool_with_aliases;
use std::{io::Result, sync::Arc};
+3 -3
View File
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use rustfs_ecstore::api::{
bucket::{metadata_sys as ecstore_metadata_sys, migration as ecstore_migration, replication as ecstore_replication},
storage::ECStore,
use crate::storage::{
ECStore,
ecstore_bucket::{metadata_sys as ecstore_metadata_sys, migration as ecstore_migration, replication as ecstore_replication},
};
use rustfs_storage_api::{BucketOperations, BucketOptions};
use std::{
+1 -1
View File
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::ecstore_layout::EndpointServerPools;
use rustfs_config::{
DEFAULT_RUSTFS_UNSUPPORTED_FS_POLICY, ENV_RUSTFS_UNSUPPORTED_FS_POLICY, RUSTFS_UNSUPPORTED_FS_POLICY_FAIL,
RUSTFS_UNSUPPORTED_FS_POLICY_WARN,
};
use rustfs_ecstore::api::layout::EndpointServerPools;
use std::collections::BTreeSet;
use std::io::{Error, Result};
use tracing::warn;
+1 -1
View File
@@ -14,8 +14,8 @@
use crate::app::context::AppContext;
use crate::server::{ServiceStateManager, publish_ready_when_runtime_ready};
use crate::storage::ECStore;
use rustfs_common::{GlobalReadiness, SystemStage};
use rustfs_ecstore::api::storage::ECStore;
use rustfs_iam::init_iam_sys;
use rustfs_kms::KmsServiceManager;
use std::future::Future;
+1 -1
View File
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::ECStore;
use crate::{
server::{ServiceStateManager, ShutdownHandle, wait_for_shutdown},
startup_iam::{IamBootstrapDisposition, publish_ready_for_iam_bootstrap},
@@ -19,7 +20,6 @@ use crate::{
startup_shutdown::run_startup_shutdown_sequence,
};
use rustfs_common::GlobalReadiness;
use rustfs_ecstore::api::storage::ECStore;
use rustfs_scanner::init_data_scanner;
use std::{
io::Result,
+2 -2
View File
@@ -13,7 +13,7 @@
// limitations under the License.
use crate::init::add_bucket_notification_configuration;
use rustfs_ecstore::api::{error as ecstore_error, layout::EndpointServerPools, notification as ecstore_notification};
use crate::storage::{ecstore_error, ecstore_layout::EndpointServerPools, ecstore_notification};
use std::{
future::Future,
io::{Error, Result},
@@ -76,7 +76,7 @@ fn log_embedded_optional_service_skipped(service: &str, err: impl std::fmt::Disp
#[cfg(test)]
mod tests {
use super::init_notification_system_with;
use rustfs_ecstore::api::error::Error as EcstoreError;
use crate::storage::ecstore_error::Error as EcstoreError;
#[tokio::test]
async fn notification_system_returns_source_error() {
+1 -1
View File
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::ecstore_global::{set_global_region, set_global_rustfs_port};
use crate::{
capacity::capacity_integration::init_capacity_management,
config::Config,
@@ -19,7 +20,6 @@ use crate::{
};
use rustfs_common::{GlobalReadiness, set_global_addr};
use rustfs_credentials::init_global_action_credentials;
use rustfs_ecstore::api::global::{set_global_region, set_global_rustfs_port};
use rustfs_utils::net::parse_and_resolve_address;
use std::{
io::{Error, Result},
+1 -1
View File
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::{ECStore, ecstore_layout::EndpointServerPools};
use crate::{
config::Config,
init::{init_buffer_profile_system, init_kms_system},
@@ -28,7 +29,6 @@ use crate::{
startup_optional_runtime_sidecars::{OptionalRuntimeServices, init_optional_runtime_services},
};
use rustfs_common::GlobalReadiness;
use rustfs_ecstore::api::{layout::EndpointServerPools, storage::ECStore};
use std::{io::Result, sync::Arc};
use tokio_util::sync::CancellationToken;
+1 -1
View File
@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::ecstore_global::shutdown_background_services;
use crate::{
server::{ServiceState, ServiceStateManager, ShutdownHandle, ShutdownSignal, shutdown_event_notifier, stop_audit_system},
startup_optional_runtime_sidecars::{
OptionalRuntimeServices, prepare_optional_runtime_shutdowns, shutdown_optional_runtime_services,
},
};
use rustfs_ecstore::api::global::shutdown_background_services;
use rustfs_heal::shutdown_ahm_services;
use rustfs_utils::get_env_bool_with_aliases;
use std::path::Path;
+5 -5
View File
@@ -13,12 +13,12 @@
// limitations under the License.
use crate::startup_fs_guard::enforce_unsupported_fs_policy;
use rustfs_common::{GlobalReadiness, SystemStage};
use rustfs_ecstore::api::storage::ECStore;
use rustfs_ecstore::api::{
bucket::replication as ecstore_replication, config as ecstore_config, global as ecstore_global, layout::EndpointServerPools,
storage as ecstore_storage,
use crate::storage::ECStore;
use crate::storage::{
ecstore_bucket::replication as ecstore_replication, ecstore_config, ecstore_global, ecstore_layout::EndpointServerPools,
ecstore_storage,
};
use rustfs_common::{GlobalReadiness, SystemStage};
use std::{
io::{Error, Result},
net::SocketAddr,
+16 -12
View File
@@ -70,18 +70,22 @@ pub(crate) use sse::{
use std::sync::Arc;
use rustfs_ecstore::api::admin as ecstore_admin;
use rustfs_ecstore::api::bucket as ecstore_bucket;
#[cfg(test)]
use rustfs_ecstore::api::config as ecstore_config;
use rustfs_ecstore::api::disk as ecstore_disk;
use rustfs_ecstore::api::error as ecstore_error;
use rustfs_ecstore::api::global as ecstore_global;
use rustfs_ecstore::api::metrics as ecstore_metrics;
use rustfs_ecstore::api::rio as ecstore_rio;
use rustfs_ecstore::api::rpc as ecstore_rpc;
use rustfs_ecstore::api::set_disk as ecstore_set_disk;
use rustfs_ecstore::api::storage as ecstore_storage;
pub(crate) use rustfs_ecstore::api::admin as ecstore_admin;
pub(crate) use rustfs_ecstore::api::bucket as ecstore_bucket;
pub(crate) use rustfs_ecstore::api::client as ecstore_client;
pub(crate) use rustfs_ecstore::api::cluster as ecstore_cluster;
pub(crate) use rustfs_ecstore::api::config as ecstore_config;
pub(crate) use rustfs_ecstore::api::disk as ecstore_disk;
pub(crate) use rustfs_ecstore::api::error as ecstore_error;
pub(crate) use rustfs_ecstore::api::event as ecstore_event;
pub(crate) use rustfs_ecstore::api::global as ecstore_global;
pub(crate) use rustfs_ecstore::api::layout as ecstore_layout;
pub(crate) use rustfs_ecstore::api::metrics as ecstore_metrics;
pub(crate) use rustfs_ecstore::api::notification as ecstore_notification;
pub(crate) use rustfs_ecstore::api::rio as ecstore_rio;
pub(crate) use rustfs_ecstore::api::rpc as ecstore_rpc;
pub(crate) use rustfs_ecstore::api::set_disk as ecstore_set_disk;
pub(crate) use rustfs_ecstore::api::storage as ecstore_storage;
pub(crate) const BUCKET_ACCELERATE_CONFIG: &str = ecstore_bucket::metadata::BUCKET_ACCELERATE_CONFIG;
pub(crate) const BUCKET_LOGGING_CONFIG: &str = ecstore_bucket::metadata::BUCKET_LOGGING_CONFIG;
+1 -1
View File
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::ecstore_client::object_api_utils::to_s3s_etag;
use crate::storage::s3_api::common::rustfs_owner;
use percent_encoding::percent_decode_str;
use rustfs_ecstore::api::client::object_api_utils::to_s3s_etag;
use rustfs_storage_api::{
BucketInfo, ListObjectVersionsInfo as StorageListObjectVersionsInfo, ListObjectsV2Info as StorageListObjectsV2Info,
};
+2 -2
View File
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::ecstore_client::object_api_utils::to_s3s_etag;
use crate::storage::s3_api::common::{rustfs_initiator, rustfs_owner};
use rustfs_ecstore::api::client::object_api_utils::to_s3s_etag;
use rustfs_storage_api::{ListMultipartsInfo, ListPartsInfo};
use s3s::dto::{CommonPrefix, ListMultipartUploadsOutput, ListPartsOutput, MultipartUpload, Part, Timestamp};
use s3s::{S3Error, S3ErrorCode};
@@ -195,8 +195,8 @@ mod tests {
MAX_MULTIPART_UPLOADS_LIST, build_list_multipart_uploads_output, build_list_parts_output,
parse_list_multipart_uploads_params, parse_list_parts_params, parse_upload_part_number,
};
use crate::storage::ecstore_client::object_api_utils::to_s3s_etag;
use crate::storage::s3_api::common::{rustfs_initiator, rustfs_owner};
use rustfs_ecstore::api::client::object_api_utils::to_s3s_etag;
use rustfs_storage_api::{ListMultipartsInfo, ListPartsInfo, MultipartInfo, PartInfo};
use s3s::S3ErrorCode;
use s3s::dto::Timestamp;
+4 -4
View File
@@ -27,6 +27,10 @@ use std::{
time::{Duration as StdDuration, Instant},
};
use crate::storage::{
ecstore_bucket::{metadata as ecstore_metadata, metadata_sys as ecstore_metadata_sys},
ecstore_disk, ecstore_error, ecstore_set_disk,
};
use bytes::Bytes;
use datafusion::{
arrow::datatypes::SchemaRef,
@@ -34,10 +38,6 @@ use datafusion::{
};
use http::HeaderMap;
use metrics::{counter, histogram};
use rustfs_ecstore::api::{
bucket::{metadata as ecstore_metadata, metadata_sys as ecstore_metadata_sys},
disk as ecstore_disk, error as ecstore_error, set_disk as ecstore_set_disk,
};
use rustfs_filemeta::FileInfo;
use rustfs_storage_api::{
HTTPPreconditions, HTTPRangeSpec, ListObjectVersionsInfo as StorageListObjectVersionsInfo,
+1 -1
View File
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::storage::ecstore_bucket::{metadata_sys, replication};
use rustfs_concurrency::{
AdmissionState, WorkloadAdmissionRegistrySnapshot, WorkloadAdmissionSnapshot, WorkloadAdmissionSnapshotProvider,
WorkloadClass,
};
use rustfs_ecstore::api::bucket::{metadata_sys, replication};
use crate::storage::concurrency::get_concurrency_manager;