mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-06 20:19:14 +00:00
2ebf8bc138
* refactor(ecstore): drop the client shim, import rustfs-s3-client directly Completes the migration window opened by the rustfs-s3-client extraction (rustfs/backlog#1842 PR3): every consumer now imports the client crate directly and the crate::client shim is deleted. - All in-crate crate::client:: paths (tier warm backends, tier core, lifecycle tier_sweeper, replication storage boundary, set_disk) now import rustfs_s3_client::* directly; crates/ecstore/src/client/mod.rs and the lib.rs mod client declaration are gone. - The two server-side modules historically misfiled under client/ move to their real homes: object_api_utils.rs to crates/ecstore/src/object_api/ (it builds engine-side object readers/writers), and object_handlers_common.rs to crates/ecstore/src/bucket/lifecycle/ (it is the lifecycle noncurrent-version cleanup helper). The latter now routes its replication calls through the lifecycle replication_sink boundary (schedule_delete wrapper and the sink's ReplicationObjectBridge re-export), as the lifecycle guard requires. - The ecstore public facade drops api::client: object_api_utils is exposed as api::object_api_utils, and the rustfs crate takes admin_handler_utils (AdminError) from rustfs-s3-client directly (new dependency). - Guard updates: the migration guard no longer pins mod client in ecstore's lib.rs or the admin_handler_utils facade module (it pins the new api::object_api_utils facade instead), and the module-lint register follows object_api_utils.rs to its new path. Verification: cargo check -p rustfs-ecstore --all-targets and -p rustfs; cargo fmt --all; tier/transition/lifecycle-focused nextest (626 passed) and the decommission/rebalance/heal families in a filtered run (603 passed; the full-suite parallel run only fails on this machine's known decommission/rebalance baseline flakes, which pass in filtered reruns and fail identically on pristine origin/main); layer/migration/s3s/logging/error-format/doc-path guard scripts all pass. * docs(architecture): record the S3 client extraction and reword invariant 4 (#6669) Closes the documentation step of rustfs/backlog#1842. ARCHITECTURE.md invariant 4 now states the serving-vs-consuming distinction the adversarial ruling asked for: ecstore must not serve HTTP/S3 wire types, while consuming remote S3 endpoints is a legitimate engine capability that lives in the extracted rustfs-s3-client crate. The violation note is updated from the pre-extraction snapshot (58 files, embedded client) to the current ratcheted state (shrink-only S3S_ECSTORE_FILES_BASELINE in scripts/check_s3s_footprint.sh, object_lock converted first), and the crate map gains s3-client. ecstore-module-split-plan.md gets the client-directory entry the plan was missing: a Current Shape row and a completed-extraction section describing the pure-move + shim + direct-import sequence and the re-homing of the two misfiled server-side modules.
108 lines
3.3 KiB
Rust
108 lines
3.3 KiB
Rust
// 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.
|
|
|
|
#![recursion_limit = "256"]
|
|
|
|
/// Scope-based hotpath measurement for `#[async_trait]` methods, where
|
|
/// `#[hotpath::measure]` would only time the boxed-future construction.
|
|
/// The guard records wall time from this statement until the enclosing
|
|
/// (desugared) async block completes, including early returns via `?`.
|
|
#[cfg(feature = "hotpath")]
|
|
#[macro_export]
|
|
macro_rules! hp_guard {
|
|
($label:expr) => {
|
|
let _hotpath_scope_guard = ::hotpath::functions::build_measurement_guard_sync($label, false);
|
|
};
|
|
}
|
|
|
|
#[cfg(not(feature = "hotpath"))]
|
|
#[macro_export]
|
|
macro_rules! hp_guard {
|
|
($label:expr) => {};
|
|
}
|
|
|
|
pub mod api;
|
|
mod bucket;
|
|
mod cache_value;
|
|
mod cluster;
|
|
mod config;
|
|
mod core;
|
|
mod crash_inject;
|
|
mod data_movement;
|
|
mod data_usage;
|
|
mod diagnostics;
|
|
mod disk;
|
|
mod erasure;
|
|
mod error;
|
|
mod io_support;
|
|
pub(crate) mod layout;
|
|
mod multipart_listing;
|
|
mod object_api;
|
|
mod runtime;
|
|
mod services;
|
|
mod set_disk;
|
|
mod storage_api_contracts;
|
|
mod store;
|
|
|
|
// pub mod checksum;
|
|
mod event;
|
|
|
|
use rustfs_concurrency::WorkloadAdmissionSnapshotProvider;
|
|
use std::sync::Arc;
|
|
|
|
pub type WorkloadAdmissionSnapshotProviderRef = Arc<dyn WorkloadAdmissionSnapshotProvider + Send + Sync>;
|
|
|
|
pub fn set_workload_admission_snapshot_provider(
|
|
provider: WorkloadAdmissionSnapshotProviderRef,
|
|
) -> std::result::Result<(), WorkloadAdmissionSnapshotProviderRef> {
|
|
runtime::sources::set_workload_admission_snapshot_provider(provider)
|
|
}
|
|
|
|
/// Request shutdown of all long-lived peer/disk background monitor tasks.
|
|
///
|
|
/// Call this during graceful shutdown, *before* the Tokio runtime is dropped, so
|
|
/// each monitor future (and the `tracing::Span` it holds) is dropped while the
|
|
/// runtime and tracing subscriber are still alive. This avoids the
|
|
/// thread-local-storage `on_close` panic that can otherwise abort the process
|
|
/// during worker-thread teardown (issue #4264). Idempotent and cheap.
|
|
pub fn shutdown_background_monitors() {
|
|
cluster::rpc::shutdown_background_monitors();
|
|
}
|
|
|
|
/// Publish that the process is ready to serve user-object GET traffic.
|
|
///
|
|
/// Experimental metadata coalescing is allowed to run only after this point so
|
|
/// startup and internal metadata reads keep the original per-disk path.
|
|
pub fn mark_get_metadata_read_version_coalescing_service_ready() {
|
|
runtime::global::mark_get_metadata_read_version_coalescing_service_ready();
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod rio_tests {
|
|
#[test]
|
|
fn uses_expected_rio_backend() {
|
|
let expected = if cfg!(feature = "rio-v2") { "rio-v2" } else { "legacy-rio" };
|
|
assert_eq!(crate::io_support::rio::backend_name(), expected);
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
pub(crate) mod ecstore_validation_blackbox;
|
|
|
|
#[cfg(test)]
|
|
pub(crate) mod test_metrics;
|
|
|
|
#[cfg(test)]
|
|
pub(crate) mod test_tracing;
|