mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-19 19:16:17 +00:00
898aa4db95
* chore: adjudicate the last 18 bare dead_code allows in the library crates Finishes backlog#1823 step 10 outside `rustfs/src` and `protocols`: config, s3select-query, common, madmin, heal, ecstore, signer and notify. Stripped first, then clippy asked which the compiler actually missed — 8 of the 18 were inert. Seven items are deleted, each checked by grep as well as by clippy: - `common/last_minute.rs`'s private `TimedAction` (with its impl) and `SizeCategory` (with its `Display` impl). The file's public surface — `AccElem`, `LastMinuteLatency` — stays; ecstore consumes it. - `s3select-query`'s three `with_*` builders. `DefaultLogicalOptimizer::with_optimizer_rules` looks used, but the call in the same file is `SessionStateBuilder::with_optimizer_rules` from DataFusion; the local methods have no callers. - `heal/manager.rs`'s `contains_key`. Its six apparent references are all `HashMap::contains_key`. Three keep their code: - `heal/storage.rs`'s `Test` variant is constructed by the `#[cfg(test)] test()` helper, which the lib target cannot see, so it takes a reasoned allow. - `signer`'s `STREAMING_PAYLOAD_HDR` and `try_build_chunk_string_to_sign` gain the `_` prefix instead. That file already marks deliberately-unheld code that way — `_STREAMING_TRAILER_HDR`, `_PAYLOAD_CHUNK_SIZE`, and `_try_build_chunk_signature`, which is the only caller of that function. Following the existing convention removes the allow without an attribute. `protocols` keeps its four; that crate needs `--features swift,sftp` to compile fully and is verified differently. The four `#![allow(dead_code)]` in `e2e_test` are module-root blankets in test-support files, which belong to steps 1-5 rather than step 10. Refs backlog#1823 * chore(e2e_test): adjudicate the two dead_code allows the lib test target still needs `cargo clippy --all-targets` compiles e2e_test's lib test target, which the earlier pass did not cover, so these two removals only surfaced in CI. test_large_multipart_upload's allow was load-bearing: its call site in test_local_kms_multipart_upload is commented out behind "TODO: Re-enable after fixing streaming encryption issues with large files". The allow comes back with the reason string this batch uses everywhere else, so the next reader sees why it is parked instead of deleting a test we intend to run again. TestDefinition.category was the opposite: written at all six definitions, read nowhere, and its enum's impl block is empty. The live copy of that type is crates/e2e_test/src/kms/test_runner.rs, which has an as_str; the policy copy is a vestige of it. Dropping the field, the enum, and the constructor parameter leaves the runner unchanged — it dispatches on name and filters on is_critical. Verification: cargo clippy --all-targets -- -D warnings (workspace, the CI command) and cargo fmt --all --check both pass. --------- Co-authored-by: houseme <housemecn@gmail.com>
104 lines
4.3 KiB
Rust
104 lines
4.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.
|
|
|
|
mod amqp;
|
|
mod arn;
|
|
mod kafka;
|
|
mod mqtt;
|
|
mod mysql;
|
|
mod nats;
|
|
mod postgres;
|
|
mod pulsar;
|
|
mod redis;
|
|
mod store;
|
|
mod webhook;
|
|
|
|
pub use amqp::*;
|
|
pub use arn::*;
|
|
pub use kafka::*;
|
|
pub use mqtt::*;
|
|
pub use mysql::*;
|
|
pub use nats::*;
|
|
pub use postgres::*;
|
|
pub use pulsar::*;
|
|
pub use redis::*;
|
|
pub use store::*;
|
|
pub use webhook::*;
|
|
|
|
use crate::DEFAULT_DELIMITER;
|
|
|
|
/// Default target identifier for notifications,
|
|
/// Used in notification system when no specific target is provided,
|
|
/// Represents the default target stream or endpoint for notifications when no specific target is provided.
|
|
pub const DEFAULT_TARGET: &str = "1";
|
|
/// Notification prefix for routing and identification,
|
|
/// Used in notification system,
|
|
/// This prefix is utilized in constructing routes and identifiers related to notifications within the system.
|
|
pub const NOTIFY_PREFIX: &str = "notify";
|
|
|
|
/// Notification route prefix combining the notification prefix and default delimiter
|
|
/// Combines the notification prefix with the default delimiter
|
|
/// Used in notification system for defining routes related to notifications.
|
|
/// Example: "notify:/"
|
|
pub const NOTIFY_ROUTE_PREFIX: &str = const_str::concat!(NOTIFY_PREFIX, DEFAULT_DELIMITER);
|
|
|
|
/// Name of the environment variable that configures target stream concurrency.
|
|
/// Controls how many target streams are processed in parallel by the notification system.
|
|
/// Defaults to [`DEFAULT_NOTIFY_TARGET_STREAM_CONCURRENCY`] if not set.
|
|
/// Example: `RUSTFS_NOTIFY_TARGET_STREAM_CONCURRENCY=20`.
|
|
pub const ENV_NOTIFY_TARGET_STREAM_CONCURRENCY: &str = "RUSTFS_NOTIFY_TARGET_STREAM_CONCURRENCY";
|
|
|
|
/// Default concurrency for target stream processing in the notification system
|
|
/// This value is used if the environment variable `RUSTFS_NOTIFY_TARGET_STREAM_CONCURRENCY` is not set.
|
|
/// It defines how many target streams can be processed in parallel by the notification system at any given time.
|
|
/// Adjust this value based on your system's capabilities and expected load.
|
|
pub const DEFAULT_NOTIFY_TARGET_STREAM_CONCURRENCY: usize = 20;
|
|
|
|
/// Name of the environment variable that configures send concurrency.
|
|
/// Controls how many send operations are processed in parallel by the notification system.
|
|
/// Defaults to [`DEFAULT_NOTIFY_SEND_CONCURRENCY`] if not set.
|
|
/// Example: `RUSTFS_NOTIFY_SEND_CONCURRENCY=64`.
|
|
pub const ENV_NOTIFY_SEND_CONCURRENCY: &str = "RUSTFS_NOTIFY_SEND_CONCURRENCY";
|
|
|
|
/// Default concurrency for send operations in the notification system
|
|
/// This value is used if the environment variable `RUSTFS_NOTIFY_SEND_CONCURRENCY` is not set.
|
|
/// It defines how many send operations can be processed in parallel by the notification system at any given time.
|
|
/// Adjust this value based on your system's capabilities and expected load.
|
|
pub const DEFAULT_NOTIFY_SEND_CONCURRENCY: usize = 64;
|
|
|
|
pub const NOTIFY_SUB_SYSTEMS: &[&str] = &[
|
|
NOTIFY_AMQP_SUB_SYS,
|
|
NOTIFY_KAFKA_SUB_SYS,
|
|
NOTIFY_MQTT_SUB_SYS,
|
|
NOTIFY_MYSQL_SUB_SYS,
|
|
NOTIFY_NATS_SUB_SYS,
|
|
NOTIFY_POSTGRES_SUB_SYS,
|
|
NOTIFY_PULSAR_SUB_SYS,
|
|
NOTIFY_REDIS_SUB_SYS,
|
|
NOTIFY_WEBHOOK_SUB_SYS,
|
|
];
|
|
|
|
pub const NOTIFY_KAFKA_SUB_SYS: &str = "notify_kafka";
|
|
pub const NOTIFY_MQTT_SUB_SYS: &str = "notify_mqtt";
|
|
pub const NOTIFY_MYSQL_SUB_SYS: &str = "notify_mysql";
|
|
pub const NOTIFY_NATS_SUB_SYS: &str = "notify_nats";
|
|
pub const NOTIFY_NSQ_SUB_SYS: &str = "notify_nsq";
|
|
pub const NOTIFY_ES_SUB_SYS: &str = "notify_elasticsearch";
|
|
pub const NOTIFY_AMQP_SUB_SYS: &str = "notify_amqp";
|
|
pub const NOTIFY_POSTGRES_SUB_SYS: &str = "notify_postgres";
|
|
pub const NOTIFY_REDIS_SUB_SYS: &str = "notify_redis";
|
|
pub const NOTIFY_REDIS_DEFAULT_CHANNEL: &str = "rustfs_notify_channel";
|
|
pub const NOTIFY_PULSAR_SUB_SYS: &str = "notify_pulsar";
|
|
pub const NOTIFY_WEBHOOK_SUB_SYS: &str = "notify_webhook";
|