refactor: align core runtime facade helpers (#3948)

This commit is contained in:
Zhengchao An
2026-06-27 17:14:25 +08:00
committed by GitHub
parent de86025f2c
commit ab9e98a9ca
23 changed files with 193 additions and 150 deletions
+81 -15
View File
@@ -5,7 +5,7 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
## Current Context ## Current Context
- Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660) - Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660)
- Branch: `overtrue/arch-global-app-runtime-consumer-batch` - Branch: `overtrue/arch-runtime-object-store-fallback-removal`
- Baseline: completed `C-011/C-012/C-013/API-055/API-059/API-079/API-080/API-081/API-082/API-083/API-084/API-085/API-086/API-087/API-088/API-089/API-090/API-091/API-092/API-093/API-094/API-095/API-096/API-097/API-098/API-099/API-100/API-101/API-102/API-103/API-104/API-105/API-106/API-107/API-108/API-109/API-110/API-111/API-112/API-113/API-114/API-115/API-116/API-117/API-118/API-119/API-120/API-121/API-122/API-123/API-124/API-125/API-126/API-127/API-128/API-129/API-130/API-131/API-132/API-133/API-134/API-135/API-136/API-137/API-138/API-139/API-140/API-141/API-142/API-143/API-144/API-145/API-146/API-147/API-148/API-149/API-150/API-151/API-152/API-153/API-154/API-155/API-156/API-157/API-158/API-159/API-160/API-161/API-162/API-163/API-164/API-165/API-166/API-167/API-168/API-169/API-170/API-171/API-172/API-173/API-174/API-175/API-176/API-177/API-178/API-179/API-180/API-181/API-182/API-183/API-184/API-185/API-186/API-187/API-188/API-189/API-190/API-191/API-192/API-193/API-194/API-195/API-196/API-197/API-198/API-199/API-200/API-201/API-202/API-203/API-204/API-205/API-206/API-207/API-208/API-209/API-210/API-211/API-212/API-213/API-214/API-215/API-216/API-217/API-218/API-219/API-220/API-221/API-222/API-223/API-224/API-225/API-226/API-227/API-228/API-229/API-230/API-231/API-232/API-233/API-234/API-235/API-236/API-237/API-238/API-239/API-240/API-241/API-242/API-243/API-244/API-245/API-246/API-247/API-248/API-249/API-250/API-251/API-252/API-253/API-254/CTX-002`. - Baseline: completed `C-011/C-012/C-013/API-055/API-059/API-079/API-080/API-081/API-082/API-083/API-084/API-085/API-086/API-087/API-088/API-089/API-090/API-091/API-092/API-093/API-094/API-095/API-096/API-097/API-098/API-099/API-100/API-101/API-102/API-103/API-104/API-105/API-106/API-107/API-108/API-109/API-110/API-111/API-112/API-113/API-114/API-115/API-116/API-117/API-118/API-119/API-120/API-121/API-122/API-123/API-124/API-125/API-126/API-127/API-128/API-129/API-130/API-131/API-132/API-133/API-134/API-135/API-136/API-137/API-138/API-139/API-140/API-141/API-142/API-143/API-144/API-145/API-146/API-147/API-148/API-149/API-150/API-151/API-152/API-153/API-154/API-155/API-156/API-157/API-158/API-159/API-160/API-161/API-162/API-163/API-164/API-165/API-166/API-167/API-168/API-169/API-170/API-171/API-172/API-173/API-174/API-175/API-176/API-177/API-178/API-179/API-180/API-181/API-182/API-183/API-184/API-185/API-186/API-187/API-188/API-189/API-190/API-191/API-192/API-193/API-194/API-195/API-196/API-197/API-198/API-199/API-200/API-201/API-202/API-203/API-204/API-205/API-206/API-207/API-208/API-209/API-210/API-211/API-212/API-213/API-214/API-215/API-216/API-217/API-218/API-219/API-220/API-221/API-222/API-223/API-224/API-225/API-226/API-227/API-228/API-229/API-230/API-231/API-232/API-233/API-234/API-235/API-236/API-237/API-238/API-239/API-240/API-241/API-242/API-243/API-244/API-245/API-246/API-247/API-248/API-249/API-250/API-251/API-252/API-253/API-254/CTX-002`.
- Current baseline also includes API-255 from PR #3923, API-256 from PR - Current baseline also includes API-255 from PR #3923, API-256 from PR
#3925, CFG-009 from PR #3927, C-007/C-009 from PR #3935, C-008/C-010 #3925, CFG-009 from PR #3927, C-007/C-009 from PR #3935, C-008/C-010
@@ -14,19 +14,23 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
GLOB-005/CRATE-001/CRATE-002 from PR #3939, GLOB-006 from PR #3941, GLOB-005/CRATE-001/CRATE-002 from PR #3939, GLOB-006 from PR #3941,
the first GLOB-007 admin runtime context handoff from PR #3942, and the the first GLOB-007 admin runtime context handoff from PR #3942, and the
GLOB-007 admin object-store/notification/server-config consumer batch from GLOB-007 admin object-store/notification/server-config consumer batch from
PR #3943, the GLOB-007 admin runtime helper alias batch from PR #3944, and PR #3943, the GLOB-007 admin runtime helper alias batch from PR #3944, the
the GLOB-007 storage/server runtime facade consumer batch from PR #3946. GLOB-007 storage/server runtime facade consumer batch from PR #3946, the
- Current phase PR: GLOB-007 app runtime facade consumer batch. GLOB-007 app runtime facade consumer batch from PR #3947, the pending
- Based on: `origin/main` after PR #3946 merged. GLOB-007 core runtime facade consumer batch from PR #3948, and the
GLOB-007 runtime facade alias sweep merged into that base branch from
PR #3949.
- Current phase PR: GLOB-007 object-store fallback removal.
- Based on: `overtrue/arch-global-core-runtime-consumer-batch` while PR #3948
is pending.
- PR type for this branch: `ci-gate`. - PR type for this branch: `ci-gate`.
- Runtime behavior changes: none intended. - Runtime behavior changes: object-store access now requires AppContext instead
- Rust code changes: expose app runtime facade aliases as `current_*` and route of falling back to the legacy global object layer.
bucket, admin, object, multipart, select-object, and lifecycle test - Rust code changes: remove the legacy global object-store fallback from the
consumers through those names while keeping the underlying root resolvers and AppContext object-store resolver family.
fallback behavior unchanged.
- CI/script changes: none intended. - CI/script changes: none intended.
- Docs changes: update this progress ledger for the app runtime facade consumer - Docs changes: update this progress ledger for the object-store fallback
batch. removal.
## Phase 0 Tasks ## Phase 0 Tasks
@@ -2797,9 +2801,18 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
- Current slice: expose app runtime-source facade reads as `current_*` - Current slice: expose app runtime-source facade reads as `current_*`
aliases and move app bucket/admin/object/multipart/select-object consumers aliases and move app bucket/admin/object/multipart/select-object consumers
plus the lifecycle transition test off direct resolver names. plus the lifecycle transition test off direct resolver names.
- Remaining work: remove one fallback family per PR only after scans prove no - Current slice: expose root runtime-source facade reads as `current_*`
production caller depends on it; this slice keeps the fallback behavior aliases and move auth, init, startup, protocols, config info, and workload
because broader app/storage/server consumers still use the root resolvers. admission consumers off direct resolver names.
- Current slice: expose the remaining root runtime-source `current_*`
aliases, route admin/app/server/storage facade modules through alias names,
and move admin context-aware object-store, notification-system, and
server-config consumers off direct resolver names.
- Current slice: remove the legacy global object-store fallback from the
AppContext object-store resolver family after production consumers were
routed through current runtime facade helpers.
- Remaining work: remove the next fallback family per PR only after scans
prove no production caller depends on it.
- Verification: focused RustFS compile and admin test-target compile, - Verification: focused RustFS compile and admin test-target compile,
resolver residual scan, formatting, diff hygiene, architecture guard, Rust resolver residual scan, formatting, diff hygiene, architecture guard, Rust
risk scan, and full PR gate. risk scan, and full PR gate.
@@ -6066,6 +6079,15 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
| Expert | Status | Notes | | Expert | Status | Notes |
|---|---|---| |---|---|---|
| Quality/architecture | pass | GLOB-007 removes the object-store resolver family's legacy global fallback and keeps object-store access behind AppContext-backed current runtime facades. |
| Migration preservation | pass | All production object-store consumers resolve through admin, app, server, storage, or root current-runtime helpers; absent AppContext now returns `None` instead of consulting the legacy object layer. |
| Testing/verification | pass | Focused RustFS compile, formatting, architecture guard, object-store fallback residual scan, diff hygiene, and diff-added Rust risk scan are required before the full PR gate. |
| Quality/architecture | pass | GLOB-007 exposes the remaining root runtime-source `current_*` aliases and routes admin, app, server, and storage facade modules plus admin context-aware consumers through alias names. |
| Migration preservation | pass | The alias sweep delegates to the same root AppContext-first resolvers, so object-store, notification-system, server-config, KMS, IAM, endpoint, tier, scanner, lock, and metrics behavior stays unchanged. |
| Testing/verification | pass | Focused RustFS compile, formatting, architecture guard, facade residual scan, diff hygiene, and diff-added Rust risk scan are required before the full PR gate. |
| Quality/architecture | pass | GLOB-007 adds root runtime-source `current_*` aliases for core consumers and moves auth, init, startup, protocols, config info, and workload admission callers off direct resolver names. |
| Migration preservation | pass | The aliases delegate to the same root AppContext-first resolvers, so owner credentials, IAM ready lookup, notification startup, region selection, TLS generation, replication pool, buffer config, and workload admission behavior stay unchanged. |
| Testing/verification | pass | Focused RustFS compile, formatting, architecture guard, core resolver residual scan, diff hygiene, and diff-added Rust risk scan are required before the full PR gate. |
| Quality/architecture | pass | GLOB-007 exposes app runtime-source facade reads as `current_*` aliases and moves bucket, admin, object, multipart, select-object, and lifecycle test consumers off direct resolver names. | | Quality/architecture | pass | GLOB-007 exposes app runtime-source facade reads as `current_*` aliases and moves bucket, admin, object, multipart, select-object, and lifecycle test consumers off direct resolver names. |
| Migration preservation | pass | The aliases delegate to the same root runtime resolvers, so AppContext object-store selection, notification dispatch, expiry/tier handles, endpoint snapshots, encryption service, and S3 Select DB behavior stay unchanged. | | Migration preservation | pass | The aliases delegate to the same root runtime resolvers, so AppContext object-store selection, notification dispatch, expiry/tier handles, endpoint snapshots, encryption service, and S3 Select DB behavior stay unchanged. |
| Testing/verification | pass | Focused RustFS compile, formatting, architecture guard, app resolver residual scan, diff hygiene, and diff-added Rust risk scan are required before the full PR gate. | | Testing/verification | pass | Focused RustFS compile, formatting, architecture guard, app resolver residual scan, diff hygiene, and diff-added Rust risk scan are required before the full PR gate. |
@@ -6438,6 +6460,50 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
Passed before push: Passed before push:
- Issue #660 GLOB-007 object-store fallback removal:
- Branch freshness check: rebased onto
`origin/overtrue/arch-global-core-runtime-consumer-batch` after PR #3949
merged into that base branch; full PR gate passed before the rebase.
- `cargo check -p rustfs --lib`: passed.
- `cargo fmt --all`: passed.
- `cargo fmt --all --check`: passed.
- `git diff --check`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed.
- Object-store fallback residual scan: passed.
- Diff-added Rust risk scan: passed.
- Three-expert review: passed.
- `make pre-pr`: passed (`nextest`: 6917 passed, 112 skipped; doctests
passed).
- Issue #660 GLOB-007 runtime facade alias sweep:
- Branch freshness check: created from
`overtrue/arch-global-core-runtime-consumer-batch` while PR #3948 is
pending.
- `cargo check -p rustfs --lib`: passed.
- `cargo fmt --all`: passed.
- `cargo fmt --all --check`: passed.
- `git diff --check`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed.
- Runtime facade resolver residual scan: passed.
- Diff-added Rust risk scan: passed.
- Three-expert review: passed.
- `make pre-pr`: passed (`nextest`: 6917 passed, 112 skipped; doctests
passed).
- Issue #660 GLOB-007 core runtime facade consumer slice:
- Branch freshness check: rebased onto `origin/main` after PR #3947 merged.
- `cargo check -p rustfs --lib`: passed.
- `cargo fmt --all`: passed.
- `cargo fmt --all --check`: passed.
- `git diff --check`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed.
- Core runtime resolver residual scan: passed.
- Diff-added Rust risk scan: passed; no new production unwrap/expect,
panic/todo/dbg, or ad-hoc stdout/stderr.
- Three-expert review: passed.
- `make pre-pr`: passed, including 6912 nextest tests passed, 112 skipped,
and doctests.
- Issue #660 GLOB-007 app runtime facade consumer slice: - Issue #660 GLOB-007 app runtime facade consumer slice:
- Branch freshness check: rebased onto `origin/main` after PR #3946 merged. - Branch freshness check: rebased onto `origin/main` after PR #3946 merged.
- `cargo check -p rustfs --lib`: passed. - `cargo check -p rustfs --lib`: passed.
@@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
use crate::admin::handlers::target_descriptor::AdminTargetSpec; use crate::admin::handlers::target_descriptor::AdminTargetSpec;
use crate::admin::runtime_sources::{AppContext, current_app_context, resolve_object_store_handle_for_context}; use crate::admin::runtime_sources::{AppContext, current_app_context, current_object_store_handle_for_context};
use crate::admin::storage_api::config::{read_admin_config_without_migrate, save_admin_server_config}; use crate::admin::storage_api::config::{read_admin_config_without_migrate, save_admin_server_config};
use rustfs_audit::{audit_system, start_audit_system as start_global_audit_system, system::AuditSystemState}; use rustfs_audit::{audit_system, start_audit_system as start_global_audit_system, system::AuditSystemState};
use rustfs_config::DEFAULT_DELIMITER; use rustfs_config::DEFAULT_DELIMITER;
@@ -21,7 +21,7 @@ use rustfs_config::server_config::Config;
use s3s::{S3Result, s3_error}; use s3s::{S3Result, s3_error};
pub(crate) async fn load_server_config_from_store_for_context(context: Option<&AppContext>) -> S3Result<Config> { pub(crate) async fn load_server_config_from_store_for_context(context: Option<&AppContext>) -> S3Result<Config> {
let Some(store) = resolve_object_store_handle_for_context(context) else { let Some(store) = current_object_store_handle_for_context(context) else {
return Ok(Config::new()); return Ok(Config::new());
}; };
@@ -88,7 +88,7 @@ async fn update_audit_config_and_reload_for_context<F>(
where where
F: FnMut(&mut Config) -> bool, F: FnMut(&mut Config) -> bool,
{ {
let Some(store) = resolve_object_store_handle_for_context(context) else { let Some(store) = current_object_store_handle_for_context(context) else {
return Err(s3_error!(InternalError, "server storage not initialized")); return Err(s3_error!(InternalError, "server storage not initialized"));
}; };
+3 -3
View File
@@ -15,7 +15,7 @@
use crate::admin::auth::validate_admin_request; use crate::admin::auth::validate_admin_request;
use crate::admin::router::{AdminOperation, Operation, S3Router}; use crate::admin::router::{AdminOperation, Operation, S3Router};
use crate::admin::runtime_sources::{ use crate::admin::runtime_sources::{
current_app_context, publish_server_config, resolve_object_store_handle_for_context, resolve_server_config_for_context, current_app_context, current_object_store_handle_for_context, current_server_config_for_context, publish_server_config,
}; };
use crate::admin::service::config::{ use crate::admin::service::config::{
apply_dynamic_config_for_subsystem, is_dynamic_config_subsystem, signal_config_snapshot_reload, signal_dynamic_config_reload, apply_dynamic_config_for_subsystem, is_dynamic_config_subsystem, signal_config_snapshot_reload, signal_dynamic_config_reload,
@@ -712,7 +712,7 @@ fn success_response(config_applied: bool) -> S3Result<S3Response<(StatusCode, Bo
fn object_store() -> S3Result<std::sync::Arc<crate::admin::storage_api::runtime::ECStore>> { fn object_store() -> S3Result<std::sync::Arc<crate::admin::storage_api::runtime::ECStore>> {
let context = current_app_context(); let context = current_app_context();
resolve_object_store_handle_for_context(context.as_deref()) current_object_store_handle_for_context(context.as_deref())
.ok_or_else(|| s3_error!(InternalError, "server storage not initialized")) .ok_or_else(|| s3_error!(InternalError, "server storage not initialized"))
} }
@@ -730,7 +730,7 @@ async fn load_active_server_config() -> S3Result<ServerConfig> {
} }
let context = current_app_context(); let context = current_app_context();
resolve_server_config_for_context(context.as_deref()) current_server_config_for_context(context.as_deref())
.ok_or_else(|| s3_error!(InternalError, "server config is not initialized")) .ok_or_else(|| s3_error!(InternalError, "server config is not initialized"))
} }
+4 -4
View File
@@ -17,8 +17,8 @@
use crate::admin::auth::validate_admin_request; use crate::admin::auth::validate_admin_request;
use crate::admin::router::{AdminOperation, Operation, S3Router}; use crate::admin::router::{AdminOperation, Operation, S3Router};
use crate::admin::runtime_sources::{ use crate::admin::runtime_sources::{
current_app_context, current_kms_runtime_service_manager, current_or_init_kms_runtime_service_manager, current_app_context, current_kms_runtime_service_manager, current_object_store_handle_for_context,
resolve_object_store_handle_for_context, current_or_init_kms_runtime_service_manager,
}; };
use crate::admin::storage_api::config::{read_admin_config, save_admin_config}; use crate::admin::storage_api::config::{read_admin_config, save_admin_config};
use crate::auth::{check_key_valid, get_session_token}; use crate::auth::{check_key_valid, get_session_token};
@@ -107,7 +107,7 @@ fn normalize_configure_request_auth(
#[instrument(skip(config))] #[instrument(skip(config))]
async fn save_kms_config(config: &KmsConfig) -> Result<(), String> { async fn save_kms_config(config: &KmsConfig) -> Result<(), String> {
let context = current_app_context(); let context = current_app_context();
let Some(store) = resolve_object_store_handle_for_context(context.as_deref()) else { let Some(store) = current_object_store_handle_for_context(context.as_deref()) else {
return Err("Storage layer not initialized".to_string()); return Err("Storage layer not initialized".to_string());
}; };
@@ -132,7 +132,7 @@ async fn save_kms_config(config: &KmsConfig) -> Result<(), String> {
#[instrument] #[instrument]
pub async fn load_kms_config() -> Option<KmsConfig> { pub async fn load_kms_config() -> Option<KmsConfig> {
let context = current_app_context(); let context = current_app_context();
let Some(store) = resolve_object_store_handle_for_context(context.as_deref()) else { let Some(store) = current_object_store_handle_for_context(context.as_deref()) else {
warn!( warn!(
component = LOG_COMPONENT_ADMIN, component = LOG_COMPONENT_ADMIN,
subsystem = LOG_SUBSYSTEM_KMS, subsystem = LOG_SUBSYSTEM_KMS,
+4 -4
View File
@@ -16,7 +16,7 @@ use super::sts::create_oidc_sts_credentials;
use crate::admin::auth::validate_admin_request; use crate::admin::auth::validate_admin_request;
use crate::admin::router::{AdminOperation, Operation, S3Router}; use crate::admin::router::{AdminOperation, Operation, S3Router};
use crate::admin::runtime_sources::{ use crate::admin::runtime_sources::{
current_app_context, current_oidc_handle, resolve_object_store_handle_for_context, resolve_server_config_for_context, current_app_context, current_object_store_handle_for_context, current_oidc_handle, current_server_config_for_context,
}; };
use crate::admin::storage_api::config::{read_admin_config_without_migrate, save_admin_server_config}; use crate::admin::storage_api::config::{read_admin_config_without_migrate, save_admin_server_config};
use crate::auth::{check_key_valid, get_session_token}; use crate::auth::{check_key_valid, get_session_token};
@@ -795,7 +795,7 @@ fn json_response<T: Serialize>(status: StatusCode, payload: &T) -> S3Result<S3Re
async fn load_server_config_from_store() -> S3Result<ServerConfig> { async fn load_server_config_from_store() -> S3Result<ServerConfig> {
let context = current_app_context(); let context = current_app_context();
let Some(store) = resolve_object_store_handle_for_context(context.as_deref()) else { let Some(store) = current_object_store_handle_for_context(context.as_deref()) else {
return Err(s3_error!(InternalError, "storage layer not initialized")); return Err(s3_error!(InternalError, "storage layer not initialized"));
}; };
@@ -806,7 +806,7 @@ async fn load_server_config_from_store() -> S3Result<ServerConfig> {
async fn save_server_config_to_store(config: &ServerConfig) -> S3Result<()> { async fn save_server_config_to_store(config: &ServerConfig) -> S3Result<()> {
let context = current_app_context(); let context = current_app_context();
let Some(store) = resolve_object_store_handle_for_context(context.as_deref()) else { let Some(store) = current_object_store_handle_for_context(context.as_deref()) else {
return Err(s3_error!(InternalError, "storage layer not initialized")); return Err(s3_error!(InternalError, "storage layer not initialized"));
}; };
@@ -831,7 +831,7 @@ fn provider_instance_key(provider_id: &str) -> String {
fn oidc_restart_required(config: &ServerConfig) -> bool { fn oidc_restart_required(config: &ServerConfig) -> bool {
let context = current_app_context(); let context = current_app_context();
let active_config = resolve_server_config_for_context(context.as_deref()); let active_config = current_server_config_for_context(context.as_deref());
oidc_restart_required_from_active_config(config, active_config.as_ref()) oidc_restart_required_from_active_config(config, active_config.as_ref())
} }
+10 -16
View File
@@ -18,19 +18,13 @@ pub(crate) use crate::app::admin_usecase::{
}; };
use crate::app::object_usecase::DefaultObjectUsecase; use crate::app::object_usecase::DefaultObjectUsecase;
pub(crate) use crate::runtime_sources::{ pub(crate) use crate::runtime_sources::{
AppContext, publish_server_config, publish_storage_class_config, resolve_action_credentials as current_action_credentials, AppContext, current_action_credentials, current_boot_time, current_bucket_metadata_handle, current_bucket_monitor_handle,
resolve_boot_time as current_boot_time, resolve_bucket_metadata_handle as current_bucket_metadata_handle, current_daily_tier_stats, current_deployment_id, current_endpoints_handle, current_iam_handle,
resolve_bucket_monitor_handle as current_bucket_monitor_handle, resolve_daily_tier_stats as current_daily_tier_stats, current_kms_runtime_service_manager, current_notification_system_for_context, current_object_store_handle_for_context,
resolve_deployment_id as current_deployment_id, resolve_endpoints_handle as current_endpoints_handle, current_oidc_handle, current_or_init_kms_runtime_service_manager, current_outbound_tls_generation,
resolve_iam_handle as current_iam_handle, resolve_kms_runtime_service_manager as current_kms_runtime_service_manager, current_outbound_tls_state, current_ready_iam_handle, current_region, current_replication_pool_handle,
resolve_notification_system_for_context, resolve_object_store_handle_for_context, resolve_oidc_handle as current_oidc_handle, current_replication_stats_handle, current_runtime_port, current_scanner_metrics_report, current_server_config_for_context,
resolve_or_init_kms_runtime_service_manager as current_or_init_kms_runtime_service_manager, current_tier_config_handle, current_token_signing_key, publish_server_config, publish_storage_class_config,
resolve_outbound_tls_generation as current_outbound_tls_generation, resolve_outbound_tls_state as current_outbound_tls_state,
resolve_ready_iam_handle as current_ready_iam_handle, resolve_region as current_region,
resolve_replication_pool_handle as current_replication_pool_handle,
resolve_replication_stats_handle as current_replication_stats_handle, resolve_runtime_port as current_runtime_port,
resolve_scanner_metrics_report as current_scanner_metrics_report, resolve_server_config_for_context,
resolve_tier_config_handle as current_tier_config_handle, resolve_token_signing_key as current_token_signing_key,
}; };
use rustfs_config::server_config::Config; use rustfs_config::server_config::Config;
use std::sync::Arc; use std::sync::Arc;
@@ -52,15 +46,15 @@ pub(crate) fn current_app_context() -> Option<Arc<AppContext>> {
pub(crate) fn current_object_store_handle() -> Option<Arc<ECStore>> { pub(crate) fn current_object_store_handle() -> Option<Arc<ECStore>> {
let context = current_app_context(); let context = current_app_context();
resolve_object_store_handle_for_context(context.as_deref()) current_object_store_handle_for_context(context.as_deref())
} }
pub(crate) fn current_notification_system() -> Option<&'static NotificationSys> { pub(crate) fn current_notification_system() -> Option<&'static NotificationSys> {
let context = current_app_context(); let context = current_app_context();
resolve_notification_system_for_context(context.as_deref()) current_notification_system_for_context(context.as_deref())
} }
pub(crate) fn current_server_config() -> Option<Config> { pub(crate) fn current_server_config() -> Option<Config> {
let context = current_app_context(); let context = current_app_context();
resolve_server_config_for_context(context.as_deref()) current_server_config_for_context(context.as_deref())
} }
+5 -5
View File
@@ -13,8 +13,8 @@
// limitations under the License. // limitations under the License.
use crate::admin::runtime_sources::{ use crate::admin::runtime_sources::{
AppContext, current_app_context, publish_server_config, publish_storage_class_config, AppContext, current_app_context, current_notification_system_for_context, current_object_store_handle_for_context,
resolve_notification_system_for_context, resolve_object_store_handle_for_context, publish_server_config, publish_storage_class_config,
}; };
use crate::admin::storage_api::config::{STORAGE_CLASS_SUB_SYS, read_admin_config_without_migrate, storageclass}; use crate::admin::storage_api::config::{STORAGE_CLASS_SUB_SYS, read_admin_config_without_migrate, storageclass};
use crate::admin::storage_api::contract::admin::StorageAdminApi; use crate::admin::storage_api::contract::admin::StorageAdminApi;
@@ -68,7 +68,7 @@ fn invalid_request(message: impl Into<String>) -> S3Error {
} }
fn resolve_runtime_config_store_for_context(context: Option<&AppContext>) -> S3Result<std::sync::Arc<ECStore>> { fn resolve_runtime_config_store_for_context(context: Option<&AppContext>) -> S3Result<std::sync::Arc<ECStore>> {
resolve_object_store_handle_for_context(context).ok_or_else(|| internal_error("storage layer not initialized")) current_object_store_handle_for_context(context).ok_or_else(|| internal_error("storage layer not initialized"))
} }
async fn apply_storage_class_runtime_config_for_context(context: Option<&AppContext>, config: &ServerConfig) -> S3Result<()> { async fn apply_storage_class_runtime_config_for_context(context: Option<&AppContext>, config: &ServerConfig) -> S3Result<()> {
@@ -372,7 +372,7 @@ pub async fn signal_dynamic_config_reload_for_context(context: Option<&AppContex
return; return;
} }
let Some(notification_sys) = resolve_notification_system_for_context(context) else { let Some(notification_sys) = current_notification_system_for_context(context) else {
return; return;
}; };
@@ -389,7 +389,7 @@ pub async fn signal_dynamic_config_reload(sub_system: &str) {
} }
pub async fn signal_config_snapshot_reload_for_context(context: Option<&AppContext>) { pub async fn signal_config_snapshot_reload_for_context(context: Option<&AppContext>) {
let Some(notification_sys) = resolve_notification_system_for_context(context) else { let Some(notification_sys) = current_notification_system_for_context(context) else {
return; return;
}; };
+2 -2
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use crate::admin::runtime_sources::{AppContext, current_app_context, resolve_object_store_handle_for_context}; use crate::admin::runtime_sources::{AppContext, current_app_context, current_object_store_handle_for_context};
use crate::admin::site_replication_identity::{deployment_id_for_endpoint, normalize_peer_map_by_identity_with}; use crate::admin::site_replication_identity::{deployment_id_for_endpoint, normalize_peer_map_by_identity_with};
use crate::admin::storage_api::config::{read_admin_config, save_admin_config}; use crate::admin::storage_api::config::{read_admin_config, save_admin_config};
use crate::admin::storage_api::error::Error as StorageError; use crate::admin::storage_api::error::Error as StorageError;
@@ -91,7 +91,7 @@ fn normalize_site_replication_state_json(data: &[u8]) -> Result<Option<Vec<u8>>,
/// RustFS does not currently keep a separate in-memory cache for this state, /// RustFS does not currently keep a separate in-memory cache for this state,
/// so "reload" means validating that the persisted JSON is readable. /// so "reload" means validating that the persisted JSON is readable.
pub async fn reload_site_replication_runtime_state_for_context(context: Option<&AppContext>) -> S3Result<()> { pub async fn reload_site_replication_runtime_state_for_context(context: Option<&AppContext>) -> S3Result<()> {
let Some(store) = resolve_object_store_handle_for_context(context) else { let Some(store) = current_object_store_handle_for_context(context) else {
return Err(S3Error::with_message(S3ErrorCode::InternalError, "Not init".to_string())); return Err(S3Error::with_message(S3ErrorCode::InternalError, "Not init".to_string()));
}; };
+5 -19
View File
@@ -116,11 +116,9 @@ pub fn resolve_object_store_handle() -> Option<Arc<ECStore>> {
resolve_object_store_handle_for_context(context.as_deref()) resolve_object_store_handle_for_context(context.as_deref())
} }
/// Resolve object store handle using an explicit AppContext, falling back to the legacy global object layer. /// Resolve object store handle using an explicit AppContext.
pub fn resolve_object_store_handle_for_context(context: Option<&AppContext>) -> Option<Arc<ECStore>> { pub fn resolve_object_store_handle_for_context(context: Option<&AppContext>) -> Option<Arc<ECStore>> {
context context.map(|context| context.object_store())
.map(|context| context.object_store())
.or_else(runtime_sources::object_store)
} }
/// Resolve notify interface using AppContext-first precedence. /// Resolve notify interface using AppContext-first precedence.
@@ -436,9 +434,9 @@ where
#[cfg(test)] #[cfg(test)]
fn resolve_object_store_handle_with( fn resolve_object_store_handle_with(
context: Option<Arc<AppContext>>, context: Option<Arc<AppContext>>,
fallback: impl FnOnce() -> Option<Arc<ECStore>>, _fallback: impl FnOnce() -> Option<Arc<ECStore>>,
) -> Option<Arc<ECStore>> { ) -> Option<Arc<ECStore>> {
context.map(|context| context.object_store()).or_else(fallback) context.map(|context| context.object_store())
} }
fn resolve_endpoints_handle_with( fn resolve_endpoints_handle_with(
@@ -940,11 +938,6 @@ mod tests {
} }
async fn test_store() -> (TempDir, Arc<ECStore>, EndpointServerPools) { async fn test_store() -> (TempDir, Arc<ECStore>, EndpointServerPools) {
if let Some(store) = runtime_sources::object_store() {
let endpoints = EndpointServerPools(store.pools.iter().map(|pool| pool.endpoints.clone()).collect());
return (tempfile::tempdir().expect("compat test temp dir"), store, endpoints);
}
let temp_dir = tempfile::tempdir().expect("test temp dir"); let temp_dir = tempfile::tempdir().expect("test temp dir");
let disk_paths = (0..4) let disk_paths = (0..4)
.map(|index| temp_dir.path().join(format!("disk{index}"))) .map(|index| temp_dir.path().join(format!("disk{index}")))
@@ -973,10 +966,6 @@ mod tests {
}; };
let endpoint_pools = EndpointServerPools(vec![pool_endpoints]); let endpoint_pools = EndpointServerPools(vec![pool_endpoints]);
if let Some(store) = runtime_sources::object_store() {
return (temp_dir, store, endpoint_pools);
}
init_local_disks(endpoint_pools.clone()).await.expect("test local disks"); init_local_disks(endpoint_pools.clone()).await.expect("test local disks");
let store = ECStore::new( let store = ECStore::new(
"127.0.0.1:0".parse().expect("test addr"), "127.0.0.1:0".parse().expect("test addr"),
@@ -1326,10 +1315,7 @@ mod tests {
&resolve_bucket_metadata_handle_with(None, || Some(bucket_metadata.clone())).expect("fallback bucket metadata"), &resolve_bucket_metadata_handle_with(None, || Some(bucket_metadata.clone())).expect("fallback bucket metadata"),
&bucket_metadata &bucket_metadata
)); ));
assert!(Arc::ptr_eq( assert!(resolve_object_store_handle_with(None, || Some(object_store.clone())).is_none());
&resolve_object_store_handle_with(None, || Some(object_store.clone())).expect("fallback object store"),
&object_store
));
assert!(Arc::ptr_eq( assert!(Arc::ptr_eq(
&resolve_replication_stats_handle_with(None, || Some(fallback_replication_stats.clone())) &resolve_replication_stats_handle_with(None, || Some(fallback_replication_stats.clone()))
.expect("fallback replication stats"), .expect("fallback replication stats"),
+2 -6
View File
@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use super::super::storage_api::context::EndpointServerPools;
use super::super::storage_api::context::bucket::metadata_sys::BucketMetadataSys; use super::super::storage_api::context::bucket::metadata_sys::BucketMetadataSys;
use super::super::storage_api::context::runtime::{ use super::super::storage_api::context::runtime::{
BucketBandwidthMonitor, DailyAllTierStats, DynReplicationPool, ExpiryState, NotificationSys, ReplicationStats, BucketBandwidthMonitor, DailyAllTierStats, DynReplicationPool, ExpiryState, NotificationSys, ReplicationStats,
ScannerMetricsReport, StorageClassConfig, TierConfigMgr, collect_scanner_metrics_report, get_daily_all_tier_stats, ScannerMetricsReport, StorageClassConfig, TierConfigMgr, collect_scanner_metrics_report, get_daily_all_tier_stats,
get_global_boot_time, get_global_bucket_monitor, get_global_deployment_id, get_global_endpoints_opt, get_global_expiry_state, get_global_boot_time, get_global_bucket_monitor, get_global_deployment_id, get_global_endpoints_opt, get_global_expiry_state,
get_global_lock_client, get_global_lock_clients, get_global_notification_sys, get_global_region, get_global_replication_pool, get_global_lock_client, get_global_lock_clients, get_global_notification_sys, get_global_region, get_global_replication_pool,
get_global_replication_stats, get_global_tier_config_mgr, global_rustfs_port, new_object_layer_fn, set_global_storage_class, get_global_replication_stats, get_global_tier_config_mgr, global_rustfs_port, set_global_storage_class,
}; };
use super::super::storage_api::context::{ECStore, EndpointServerPools};
use crate::config::{RustFSBufferConfig, get_global_buffer_config}; use crate::config::{RustFSBufferConfig, get_global_buffer_config};
use rustfs_config::server_config::{Config, get_global_server_config, set_global_server_config}; use rustfs_config::server_config::{Config, get_global_server_config, set_global_server_config};
use rustfs_credentials::{Credentials, get_global_action_cred}; use rustfs_credentials::{Credentials, get_global_action_cred};
@@ -205,7 +205,3 @@ pub fn set_storage_class(config: StorageClassConfig) {
pub fn buffer_config() -> RustFSBufferConfig { pub fn buffer_config() -> RustFSBufferConfig {
get_global_buffer_config().clone() get_global_buffer_config().clone()
} }
pub fn object_store() -> Option<Arc<ECStore>> {
new_object_layer_fn()
}
+3 -6
View File
@@ -13,16 +13,13 @@
// limitations under the License. // limitations under the License.
pub(crate) use crate::runtime_sources::{ pub(crate) use crate::runtime_sources::{
AppContext, resolve_encryption_service as current_encryption_service, resolve_endpoints_handle as current_endpoints_handle, AppContext, current_encryption_service, current_endpoints_handle, current_expiry_state_handle, current_notification_system,
resolve_expiry_state_handle as current_expiry_state_handle, resolve_notification_system as current_notification_system, current_notify_interface_for_context, current_object_store_handle_for_context, current_s3select_db,
resolve_notify_interface_for_context as current_notify_interface_for_context,
resolve_object_store_handle_for_context as current_object_store_handle_for_context,
resolve_s3select_db as current_s3select_db,
}; };
use std::sync::Arc; use std::sync::Arc;
#[cfg(test)] #[cfg(test)]
pub(crate) use crate::runtime_sources::resolve_tier_config_handle as current_tier_config_handle; pub(crate) use crate::runtime_sources::current_tier_config_handle;
pub(crate) fn current_app_context() -> Option<Arc<AppContext>> { pub(crate) fn current_app_context() -> Option<Arc<AppContext>> {
crate::runtime_sources::current_app_context() crate::runtime_sources::current_app_context()
-4
View File
@@ -171,10 +171,6 @@ pub(crate) mod runtime {
crate::storage::storage_api::get_global_expiry_state() crate::storage::storage_api::get_global_expiry_state()
} }
pub(crate) fn new_object_layer_fn() -> Option<Arc<crate::storage::storage_api::ECStore>> {
crate::storage::storage_api::new_object_layer_fn()
}
pub(crate) fn set_object_store_resolver(resolver: Arc<ObjectStoreResolver>) -> bool { pub(crate) fn set_object_store_resolver(resolver: Arc<ObjectStoreResolver>) -> bool {
crate::storage::storage_api::set_object_store_resolver(resolver) crate::storage::storage_api::set_object_store_resolver(resolver)
} }
+6 -6
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use crate::runtime_sources::resolve_action_credentials; use crate::runtime_sources::{current_action_credentials, current_ready_iam_handle};
use http::HeaderMap; use http::HeaderMap;
use http::Uri; use http::Uri;
use rustfs_credentials::Credentials; use rustfs_credentials::Credentials;
@@ -186,7 +186,7 @@ impl S3Auth for IAMAuth {
return Ok(key); return Ok(key);
} }
if let Ok(iam_store) = crate::runtime_sources::resolve_ready_iam_handle() { if let Ok(iam_store) = current_ready_iam_handle() {
// Use check_key instead of get_user to ensure user is loaded from disk if not in cache // Use check_key instead of get_user to ensure user is loaded from disk if not in cache
// This is important for newly created users that may not be in cache yet. // This is important for newly created users that may not be in cache yet.
// check_key will automatically attempt to load the user from disk if not found in cache. // check_key will automatically attempt to load the user from disk if not found in cache.
@@ -331,7 +331,7 @@ pub async fn check_key_valid(session_token: &str, access_key: &str) -> S3Result<
return Err(s3_error!(InvalidAccessKeyId, "Keystone authentication requires X-Auth-Token header")); return Err(s3_error!(InvalidAccessKeyId, "Keystone authentication requires X-Auth-Token header"));
} }
let Some(mut cred) = resolve_action_credentials() else { let Some(mut cred) = current_action_credentials() else {
return Err(S3Error::with_message( return Err(S3Error::with_message(
S3ErrorCode::InternalError, S3ErrorCode::InternalError,
format!("get_global_action_cred {:?}", IamError::IamSysNotInitialized), format!("get_global_action_cred {:?}", IamError::IamSysNotInitialized),
@@ -341,7 +341,7 @@ pub async fn check_key_valid(session_token: &str, access_key: &str) -> S3Result<
let sys_cred = cred.clone(); let sys_cred = cred.clone();
if !constant_time_eq(&cred.access_key, access_key) { if !constant_time_eq(&cred.access_key, access_key) {
let Ok(iam_store) = crate::runtime_sources::resolve_ready_iam_handle() else { let Ok(iam_store) = current_ready_iam_handle() else {
return Err(S3Error::with_message( return Err(S3Error::with_message(
S3ErrorCode::InternalError, S3ErrorCode::InternalError,
format!("check_key_valid {:?}", IamError::IamSysNotInitialized), format!("check_key_valid {:?}", IamError::IamSysNotInitialized),
@@ -435,7 +435,7 @@ pub fn check_claims_from_token(token: &str, cred: &Credentials) -> S3Result<Hash
return Err(s3_error!(InvalidRequest, "invalid access key is temp and expired")); return Err(s3_error!(InvalidRequest, "invalid access key is temp and expired"));
} }
let Some(sys_cred) = resolve_action_credentials() else { let Some(sys_cred) = current_action_credentials() else {
return Err(s3_error!(InternalError, "action cred not init")); return Err(s3_error!(InternalError, "action cred not init"));
}; };
@@ -611,7 +611,7 @@ pub fn get_condition_values_with_query_and_client_info(
cred.access_key.clone() cred.access_key.clone()
}; };
let sys_cred = resolve_action_credentials().unwrap_or_default(); let sys_cred = current_action_credentials().unwrap_or_default();
let claims = &cred.claims; let claims = &cred.claims;
+3 -3
View File
@@ -19,7 +19,7 @@
//! configuration, and dependencies. //! configuration, and dependencies.
use super::{InfoOpts, InfoType}; use super::{InfoOpts, InfoType};
use crate::runtime_sources::resolve_buffer_config; use crate::runtime_sources::current_buffer_config;
use crate::version::build; use crate::version::build;
use rustfs_credentials::Masked; use rustfs_credentials::Masked;
use serde::Serialize; use serde::Serialize;
@@ -546,7 +546,7 @@ fn collect_config_info_json() -> ConfigInfoJson {
let workload_profile = { let workload_profile = {
use super::workload_profiles::is_buffer_profile_enabled; use super::workload_profiles::is_buffer_profile_enabled;
if is_buffer_profile_enabled() { if is_buffer_profile_enabled() {
let config = resolve_buffer_config(); let config = current_buffer_config();
let profile = config.workload_profile(); let profile = config.workload_profile();
let buffer_config = profile.config(); let buffer_config = profile.config();
Some(WorkloadProfileJson { Some(WorkloadProfileJson {
@@ -870,7 +870,7 @@ fn get_workload_profile_info() -> String {
return "| Workload Profile | (disabled) |".to_string(); return "| Workload Profile | (disabled) |".to_string();
} }
let config = resolve_buffer_config(); let config = current_buffer_config();
let profile = config.workload_profile(); let profile = config.workload_profile();
let name = config.workload_name(); let name = config.workload_name();
let buffer_config = profile.config(); let buffer_config = profile.config();
+3 -3
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use crate::runtime_sources::{resolve_notify_interface, resolve_region}; use crate::runtime_sources::{current_notify_interface, current_region};
use crate::server::ShutdownHandle; use crate::server::ShutdownHandle;
use crate::storage_api::startup::init::{ use crate::storage_api::startup::init::{
get_bucket_notification_config, process_lambda_configurations, process_queue_configurations, process_topic_configurations, get_bucket_notification_config, process_lambda_configurations, process_queue_configurations, process_topic_configurations,
@@ -158,7 +158,7 @@ fn arn_to_target_id(arn_str: &str) -> Result<rustfs_targets::arn::TargetID, Targ
/// * `buckets` - A vector of bucket names to process /// * `buckets` - A vector of bucket names to process
#[instrument(skip_all)] #[instrument(skip_all)]
pub async fn add_bucket_notification_configuration(buckets: Vec<String>) { pub async fn add_bucket_notification_configuration(buckets: Vec<String>) {
let global_region = resolve_region(); let global_region = current_region();
let region = global_region let region = global_region
.as_ref() .as_ref()
.filter(|r| !r.as_str().is_empty()) .filter(|r| !r.as_str().is_empty())
@@ -244,7 +244,7 @@ pub async fn add_bucket_notification_configuration(buckets: Vec<String>) {
); );
} }
if let Err(e) = resolve_notify_interface() if let Err(e) = current_notify_interface()
.add_event_specific_rules(bucket, region, &event_rules) .add_event_specific_rules(bucket, region, &event_rules)
.await .await
.map_err(|e| s3_error!(InternalError, "Failed to add rules: {e}")) .map_err(|e| s3_error!(InternalError, "Failed to add rules: {e}"))
+2 -2
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use crate::runtime_sources::resolve_action_credentials; use crate::runtime_sources::current_action_credentials;
use crate::storage_api::protocols::client::{FS, ReqInfo, RequestContext}; use crate::storage_api::protocols::client::{FS, ReqInfo, RequestContext};
use http::{HeaderMap, Method}; use http::{HeaderMap, Method};
use percent_encoding::{AsciiSet, CONTROLS, utf8_percent_encode}; use percent_encoding::{AsciiSet, CONTROLS, utf8_percent_encode};
@@ -140,7 +140,7 @@ impl ProtocolStorageClient {
) -> S3Result<S3Request<T>> { ) -> S3Result<S3Request<T>> {
let mut extensions = http::Extensions::default(); let mut extensions = http::Extensions::default();
let is_owner = if let Some(global_cred) = resolve_action_credentials() { let is_owner = if let Some(global_cred) = current_action_credentials() {
params.access_key == global_cred.access_key params.access_key == global_cred.access_key
} else { } else {
false false
+24 -11
View File
@@ -17,17 +17,30 @@ use std::sync::Arc;
pub(crate) use context::{ pub(crate) use context::{
AppContext, NotifyInterface, publish_oidc_handle, publish_server_config, publish_storage_class_config, AppContext, NotifyInterface, publish_oidc_handle, publish_server_config, publish_storage_class_config,
resolve_action_credentials, resolve_boot_time, resolve_bucket_metadata_handle, resolve_bucket_monitor_handle, resolve_action_credentials as current_action_credentials, resolve_boot_time as current_boot_time,
resolve_buffer_config, resolve_daily_tier_stats, resolve_deployment_id, resolve_encryption_service, resolve_endpoints_handle, resolve_bucket_metadata_handle as current_bucket_metadata_handle,
resolve_expiry_state_handle, resolve_iam_handle, resolve_iam_ready, resolve_internode_metrics, resolve_bucket_monitor_handle as current_bucket_monitor_handle, resolve_buffer_config as current_buffer_config,
resolve_kms_runtime_service_manager, resolve_local_node_name, resolve_lock_client, resolve_lock_clients_handle, resolve_daily_tier_stats as current_daily_tier_stats, resolve_deployment_id as current_deployment_id,
resolve_notification_system, resolve_notification_system_for_context, resolve_notify_interface, resolve_encryption_service as current_encryption_service, resolve_endpoints_handle as current_endpoints_handle,
resolve_notify_interface_for_context, resolve_object_store_handle, resolve_object_store_handle_for_context, resolve_expiry_state_handle as current_expiry_state_handle, resolve_iam_handle as current_iam_handle,
resolve_oidc_handle, resolve_or_init_kms_runtime_service_manager, resolve_outbound_tls_generation, resolve_iam_ready as current_iam_ready, resolve_internode_metrics as current_internode_metrics,
resolve_outbound_tls_state, resolve_performance_metrics, resolve_ready_iam_handle, resolve_region, resolve_kms_runtime_service_manager as current_kms_runtime_service_manager,
resolve_replication_pool_handle, resolve_replication_stats_handle, resolve_runtime_port, resolve_s3select_db, resolve_local_node_name as current_local_node_name, resolve_lock_client as current_lock_client,
resolve_scanner_metrics_report, resolve_server_config, resolve_server_config_for_context, resolve_tier_config_handle, resolve_lock_clients_handle as current_lock_clients_handle, resolve_notification_system as current_notification_system,
resolve_token_signing_key, resolve_notification_system_for_context as current_notification_system_for_context,
resolve_notify_interface as current_notify_interface,
resolve_notify_interface_for_context as current_notify_interface_for_context,
resolve_object_store_handle as current_object_store_handle,
resolve_object_store_handle_for_context as current_object_store_handle_for_context,
resolve_oidc_handle as current_oidc_handle,
resolve_or_init_kms_runtime_service_manager as current_or_init_kms_runtime_service_manager,
resolve_outbound_tls_generation as current_outbound_tls_generation, resolve_outbound_tls_state as current_outbound_tls_state,
resolve_performance_metrics as current_performance_metrics, resolve_ready_iam_handle as current_ready_iam_handle,
resolve_region as current_region, resolve_replication_pool_handle as current_replication_pool_handle,
resolve_replication_stats_handle as current_replication_stats_handle, resolve_runtime_port as current_runtime_port,
resolve_s3select_db as current_s3select_db, resolve_scanner_metrics_report as current_scanner_metrics_report,
resolve_server_config as current_server_config, resolve_server_config_for_context as current_server_config_for_context,
resolve_tier_config_handle as current_tier_config_handle, resolve_token_signing_key as current_token_signing_key,
}; };
#[cfg(test)] #[cfg(test)]
+8 -11
View File
@@ -12,10 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use crate::runtime_sources::{ use crate::runtime_sources::NotifyInterface;
NotifyInterface, resolve_endpoints_handle, resolve_iam_ready, resolve_kms_runtime_service_manager,
resolve_lock_clients_handle, resolve_notify_interface, resolve_object_store_handle, resolve_server_config,
};
use crate::storage_api::server::runtime_sources::{ECStore, EndpointServerPools}; use crate::storage_api::server::runtime_sources::{ECStore, EndpointServerPools};
use rustfs_kms::KmsServiceManager; use rustfs_kms::KmsServiceManager;
use rustfs_lock::LockClient; use rustfs_lock::LockClient;
@@ -23,29 +20,29 @@ use std::collections::HashMap;
use std::sync::Arc; use std::sync::Arc;
pub(crate) fn current_kms_runtime_service_manager() -> Option<Arc<KmsServiceManager>> { pub(crate) fn current_kms_runtime_service_manager() -> Option<Arc<KmsServiceManager>> {
resolve_kms_runtime_service_manager() crate::runtime_sources::current_kms_runtime_service_manager()
} }
pub(crate) fn current_server_config() -> Option<rustfs_config::server_config::Config> { pub(crate) fn current_server_config() -> Option<rustfs_config::server_config::Config> {
resolve_server_config() crate::runtime_sources::current_server_config()
} }
pub(crate) fn current_notify_interface() -> Arc<dyn NotifyInterface> { pub(crate) fn current_notify_interface() -> Arc<dyn NotifyInterface> {
resolve_notify_interface() crate::runtime_sources::current_notify_interface()
} }
pub(crate) fn current_object_store_handle() -> Option<Arc<ECStore>> { pub(crate) fn current_object_store_handle() -> Option<Arc<ECStore>> {
resolve_object_store_handle() crate::runtime_sources::current_object_store_handle()
} }
pub(crate) fn current_iam_ready() -> bool { pub(crate) fn current_iam_ready() -> bool {
resolve_iam_ready() crate::runtime_sources::current_iam_ready()
} }
pub(crate) fn current_endpoints_handle() -> Option<EndpointServerPools> { pub(crate) fn current_endpoints_handle() -> Option<EndpointServerPools> {
resolve_endpoints_handle() crate::runtime_sources::current_endpoints_handle()
} }
pub(crate) fn current_lock_clients_handle() -> Option<HashMap<String, Arc<dyn LockClient>>> { pub(crate) fn current_lock_clients_handle() -> Option<HashMap<String, Arc<dyn LockClient>>> {
resolve_lock_clients_handle() crate::runtime_sources::current_lock_clients_handle()
} }
+5 -3
View File
@@ -13,7 +13,9 @@
// limitations under the License. // limitations under the License.
use crate::config::RustFSBufferConfig; use crate::config::RustFSBufferConfig;
use crate::runtime_sources::{resolve_outbound_tls_generation, resolve_replication_pool_handle}; use crate::runtime_sources::{
current_outbound_tls_generation as runtime_current_outbound_tls_generation, current_replication_pool_handle,
};
use crate::storage_api::startup::runtime_sources::{DynReplicationPool, set_global_region, set_global_rustfs_port}; use crate::storage_api::startup::runtime_sources::{DynReplicationPool, set_global_region, set_global_rustfs_port};
use rustfs_kms::KmsServiceManager; use rustfs_kms::KmsServiceManager;
use rustfs_obs::{GlobalError as ObservabilityError, OtelGuard}; use rustfs_obs::{GlobalError as ObservabilityError, OtelGuard};
@@ -73,7 +75,7 @@ pub(crate) fn init_metrics_runtime(ctx: CancellationToken) {
} }
pub(crate) fn replication_pool_handle() -> Option<Arc<DynReplicationPool>> { pub(crate) fn replication_pool_handle() -> Option<Arc<DynReplicationPool>> {
resolve_replication_pool_handle() current_replication_pool_handle()
} }
pub(crate) fn set_put_stage_metrics_enabled(enabled: bool) { pub(crate) fn set_put_stage_metrics_enabled(enabled: bool) {
@@ -89,7 +91,7 @@ pub(crate) fn init_tls_metrics() {
} }
pub(crate) fn current_outbound_tls_generation() -> u64 { pub(crate) fn current_outbound_tls_generation() -> u64 {
resolve_outbound_tls_generation().0 runtime_current_outbound_tls_generation().0
} }
pub(crate) async fn publish_outbound_tls_state(generation: TlsGeneration, outbound: &OutboundTlsMaterial) { pub(crate) async fn publish_outbound_tls_state(generation: TlsGeneration, outbound: &OutboundTlsMaterial) {
+3 -3
View File
@@ -73,9 +73,9 @@ pub(crate) use storage_api::{
global_rustfs_port, head_prefix_consumer, helper_consumer, init_background_replication, init_bucket_metadata_sys, global_rustfs_port, head_prefix_consumer, helper_consumer, init_background_replication, init_bucket_metadata_sys,
init_ecstore_config, init_global_config_sys, init_local_disks, init_lock_clients, is_all_buckets_not_found, is_dist_erasure, init_ecstore_config, init_global_config_sys, init_local_disks, init_lock_clients, is_all_buckets_not_found, is_dist_erasure,
is_err_bucket_not_found, is_err_object_not_found, is_err_version_not_found, is_valid_storage_class, load_bucket_metadata, is_err_bucket_not_found, is_err_object_not_found, is_err_version_not_found, is_valid_storage_class, load_bucket_metadata,
new_global_notification_sys, new_object_layer_fn, options_consumer, prewarm_local_disk_id_map, read_config, new_global_notification_sys, options_consumer, prewarm_local_disk_id_map, read_config, record_replication_proxy,
record_replication_proxy, register_event_dispatch_hook, reload_transition_tier_config, replication_queue_current_count, register_event_dispatch_hook, reload_transition_tier_config, replication_queue_current_count, rpc_consumer,
rpc_consumer, runtime_sources_consumer, s3_api_consumer, save_config, serialize, set_bucket_metadata, set_global_endpoints, runtime_sources_consumer, s3_api_consumer, save_config, serialize, set_bucket_metadata, set_global_endpoints,
set_global_region, set_global_rustfs_port, set_object_store_resolver, set_workload_admission_snapshot_provider, set_global_region, set_global_rustfs_port, set_object_store_resolver, set_workload_admission_snapshot_provider,
shutdown_background_services, table_catalog_path_hash, to_s3s_etag, topology_snapshot_from_endpoint_pools_with_capabilities, shutdown_background_services, table_catalog_path_hash, to_s3s_etag, topology_snapshot_from_endpoint_pools_with_capabilities,
try_migrate_bucket_metadata, try_migrate_iam_config, try_migrate_server_config, update_bucket_metadata_config, try_migrate_bucket_metadata, try_migrate_iam_config, try_migrate_server_config, update_bucket_metadata_config,
+13 -13
View File
@@ -29,53 +29,53 @@ pub(crate) fn current_app_context() -> Option<Arc<AppContext>> {
} }
pub(crate) fn current_object_store_handle() -> Option<Arc<ECStore>> { pub(crate) fn current_object_store_handle() -> Option<Arc<ECStore>> {
root_runtime_sources::resolve_object_store_handle() root_runtime_sources::current_object_store_handle()
} }
pub(crate) fn current_object_store_handle_for_context(context: Option<&AppContext>) -> Option<Arc<ECStore>> { pub(crate) fn current_object_store_handle_for_context(context: Option<&AppContext>) -> Option<Arc<ECStore>> {
root_runtime_sources::resolve_object_store_handle_for_context(context) root_runtime_sources::current_object_store_handle_for_context(context)
} }
pub(crate) fn current_buffer_config() -> RustFSBufferConfig { pub(crate) fn current_buffer_config() -> RustFSBufferConfig {
root_runtime_sources::resolve_buffer_config() root_runtime_sources::current_buffer_config()
} }
pub(crate) fn current_internode_metrics() -> Arc<InternodeMetrics> { pub(crate) fn current_internode_metrics() -> Arc<InternodeMetrics> {
root_runtime_sources::resolve_internode_metrics() root_runtime_sources::current_internode_metrics()
} }
pub(crate) async fn current_local_node_name() -> String { pub(crate) async fn current_local_node_name() -> String {
root_runtime_sources::resolve_local_node_name().await root_runtime_sources::current_local_node_name().await
} }
pub(crate) fn current_action_credentials() -> Option<Credentials> { pub(crate) fn current_action_credentials() -> Option<Credentials> {
root_runtime_sources::resolve_action_credentials() root_runtime_sources::current_action_credentials()
} }
pub(crate) fn current_notify_interface() -> Arc<dyn root_runtime_sources::NotifyInterface> { pub(crate) fn current_notify_interface() -> Arc<dyn root_runtime_sources::NotifyInterface> {
root_runtime_sources::resolve_notify_interface() root_runtime_sources::current_notify_interface()
} }
pub(crate) fn current_performance_metrics() -> Arc<PerformanceMetrics> { pub(crate) fn current_performance_metrics() -> Arc<PerformanceMetrics> {
root_runtime_sources::resolve_performance_metrics() root_runtime_sources::current_performance_metrics()
} }
pub(crate) async fn current_encryption_service() -> Option<Arc<ObjectEncryptionService>> { pub(crate) async fn current_encryption_service() -> Option<Arc<ObjectEncryptionService>> {
root_runtime_sources::resolve_encryption_service().await root_runtime_sources::current_encryption_service().await
} }
pub(crate) fn current_region() -> Option<s3s::region::Region> { pub(crate) fn current_region() -> Option<s3s::region::Region> {
root_runtime_sources::resolve_region() root_runtime_sources::current_region()
} }
pub(crate) fn current_ready_iam_handle() -> IamResult<Arc<IamSys<ObjectStore>>> { pub(crate) fn current_ready_iam_handle() -> IamResult<Arc<IamSys<ObjectStore>>> {
root_runtime_sources::resolve_ready_iam_handle() root_runtime_sources::current_ready_iam_handle()
} }
pub(crate) fn current_iam_handle() -> Option<Arc<IamSys<ObjectStore>>> { pub(crate) fn current_iam_handle() -> Option<Arc<IamSys<ObjectStore>>> {
root_runtime_sources::resolve_iam_handle() root_runtime_sources::current_iam_handle()
} }
pub(crate) fn current_lock_client() -> Option<Arc<dyn LockClient>> { pub(crate) fn current_lock_client() -> Option<Arc<dyn LockClient>> {
root_runtime_sources::resolve_lock_client() root_runtime_sources::current_lock_client()
} }
+2 -6
View File
@@ -378,8 +378,8 @@ pub(crate) mod ecstore_global {
pub(crate) use rustfs_ecstore::api::global::{ pub(crate) use rustfs_ecstore::api::global::{
GLOBAL_BOOT_TIME, GLOBAL_TierConfigMgr, get_global_bucket_monitor, get_global_deployment_id, get_global_endpoints_opt, GLOBAL_BOOT_TIME, GLOBAL_TierConfigMgr, get_global_bucket_monitor, get_global_deployment_id, get_global_endpoints_opt,
get_global_lock_client, get_global_lock_clients, get_global_region, get_global_tier_config_mgr, global_rustfs_port, get_global_lock_client, get_global_lock_clients, get_global_region, get_global_tier_config_mgr, global_rustfs_port,
is_dist_erasure, new_object_layer_fn, set_global_endpoints, set_global_region, set_global_rustfs_port, is_dist_erasure, set_global_endpoints, set_global_region, set_global_rustfs_port, set_object_store_resolver,
set_object_store_resolver, shutdown_background_services, update_erasure_type, shutdown_background_services, update_erasure_type,
}; };
} }
@@ -1111,10 +1111,6 @@ pub(crate) fn get_global_tier_config_mgr() -> Arc<tokio::sync::RwLock<TierConfig
ecstore_global::get_global_tier_config_mgr() ecstore_global::get_global_tier_config_mgr()
} }
pub(crate) fn new_object_layer_fn() -> Option<Arc<ECStore>> {
ecstore_global::new_object_layer_fn()
}
pub(crate) fn set_object_store_resolver(resolver: Arc<ObjectStoreResolver>) -> bool { pub(crate) fn set_object_store_resolver(resolver: Arc<ObjectStoreResolver>) -> bool {
ecstore_global::set_object_store_resolver(resolver) ecstore_global::set_object_store_resolver(resolver)
} }
+2 -2
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use crate::runtime_sources::resolve_replication_pool_handle; use crate::runtime_sources::current_replication_pool_handle;
use crate::storage_api::workload::admission::{bucket_metadata_runtime_initialized, replication_queue_current_count}; use crate::storage_api::workload::admission::{bucket_metadata_runtime_initialized, replication_queue_current_count};
use rustfs_concurrency::{ use rustfs_concurrency::{
AdmissionState, WorkloadAdmissionRegistrySnapshot, WorkloadAdmissionSnapshot, WorkloadAdmissionSnapshotProvider, AdmissionState, WorkloadAdmissionRegistrySnapshot, WorkloadAdmissionSnapshot, WorkloadAdmissionSnapshotProvider,
@@ -175,7 +175,7 @@ fn repair_workload_admission_snapshot_from_counts(
} }
pub fn replication_workload_admission_snapshot() -> WorkloadAdmissionSnapshot { pub fn replication_workload_admission_snapshot() -> WorkloadAdmissionSnapshot {
let Some(pool) = resolve_replication_pool_handle() else { let Some(pool) = current_replication_pool_handle() else {
return replication_workload_admission_snapshot_from_counts(false, None, None); return replication_workload_admission_snapshot_from_counts(false, None, None);
}; };