Skip to content

refactor: replace lazy_static with LazyLock and notify crate registry create_targets_from_config #311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Jul 30, 2025

Conversation

houseme
Copy link
Contributor

@houseme houseme commented Jul 30, 2025

Type of Change

  • New Feature
  • Bug Fix
  • Documentation
  • Performance Improvement
  • Test/CI
  • Refactor
  • Other:

Related Issues

Summary of Changes

Checklist

  • I have read and followed the CONTRIBUTING.md guidelines
  • Code is formatted with cargo fmt --all
  • Passed cargo clippy --all-targets --all-features -- -D warnings
  • Passed cargo check --all-targets
  • Added/updated necessary tests
  • Documentation updated (if needed)
  • CI/CD passed (if applicable)

Impact

  • Breaking change (compatibility)
  • Requires doc/config/deployment update
  • Other impact:

Additional Notes


Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.

houseme and others added 30 commits July 20, 2025 11:04
* fix unzip error

* fix url change error

fix url change error

* Simplify user experience and integrate console and endpoint

Simplify user experience and integrate console and endpoint

* Add gnu to  build.yml
* main:
  fix
  fix
  fix
  fix: windows build
  Add GNU to  build.yml (#275)
  improve code for logger and fix typo (#272)

# Conflicts:
#	.github/workflows/build.yml
)

Resolves #277

- Add --fix flag to automatically fix clippy warnings
- Add --allow-dirty flag to run on dirty Git trees
- Improves code quality in pre-commit workflow
- Fix Windows zip command issue by using PowerShell Compress-Archive
- Add Windows support for OSS upload with ossutil
- Replace Chinese comments with English in build.yml
- Fix bash syntax error in package_zip function
- Improve code formatting and consistency
- Update various configuration files for better cross-platform support

Resolves Windows build failures in GitHub Actions.
add support on loongarch64
Bumps the dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [hyper-util](https://github.com/hyperium/hyper-util) | `0.1.15` | `0.1.16` |
| [rand](https://github.com/rust-random/rand) | `0.9.1` | `0.9.2` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.140` | `1.0.141` |
| [strum](https://github.com/Peternator7/strum) | `0.27.1` | `0.27.2` |
| [sysinfo](https://github.com/GuillaumeGomez/sysinfo) | `0.36.0` | `0.36.1` |


Updates `hyper-util` from 0.1.15 to 0.1.16
- [Release notes](https://github.com/hyperium/hyper-util/releases)
- [Changelog](https://github.com/hyperium/hyper-util/blob/master/CHANGELOG.md)
- [Commits](hyperium/hyper-util@v0.1.15...v0.1.16)

Updates `rand` from 0.9.1 to 0.9.2
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](rust-random/rand@rand_core-0.9.1...rand_core-0.9.2)

Updates `serde_json` from 1.0.140 to 1.0.141
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.140...v1.0.141)

Updates `strum` from 0.27.1 to 0.27.2
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](Peternator7/strum@v0.27.1...v0.27.2)

Updates `sysinfo` from 0.36.0 to 0.36.1
- [Changelog](https://github.com/GuillaumeGomez/sysinfo/blob/master/CHANGELOG.md)
- [Commits](GuillaumeGomez/sysinfo@v0.36.0...v0.36.1)

---
updated-dependencies:
- dependency-name: hyper-util
  dependency-version: 0.1.16
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: rand
  dependency-version: 0.9.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: serde_json
  dependency-version: 1.0.141
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: strum
  dependency-version: 0.27.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: sysinfo
  dependency-version: 0.36.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: junxiang Mu <1948535941@qq.com>
Signed-off-by: junxiang Mu <1948535941@qq.com>
Signed-off-by: junxiang Mu <1948535941@qq.com>
Signed-off-by: junxiang Mu <1948535941@qq.com>
# Conflicts:
#	Cargo.lock
#	crates/e2e_test/Cargo.toml
#	crates/s3select-query/src/lib.rs
* fix

* fix

* fix

* fix delete-marker expiration. add api_restore.

* fix

* time retry object upload

* lock file

* make fmt

* fix

* restore object

* fix

* fix

* serde-rs-xml -> quick-xml

* fix

* checksum

* fix

* fix

* fix

* fix

* fix

* fix

* fix
@houseme houseme requested a review from Copilot July 30, 2025 08:48
@CLAassistant
Copy link

CLAassistant commented Jul 30, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
3 out of 4 committers have signed the CLA.

✅ MiPnamic
✅ likewu
✅ zhangwenlong8911
❌ dependabot[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot

This comment was marked as outdated.

@houseme houseme requested a review from Copilot July 30, 2025 09:30
Copilot

This comment was marked as outdated.

@houseme houseme requested a review from Copilot July 30, 2025 09:46
Copilot

This comment was marked as outdated.

@houseme houseme requested a review from Copilot July 30, 2025 10:05
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR performs a comprehensive refactor to modernize the RustFS codebase by replacing lazy_static with Rust's stable LazyLock and significantly refactoring the notification system's target registry functionality.

  • Replaced lazy_static macros with standard library LazyLock for improved performance and reduced dependencies
  • Refactored notification target creation to support concurrent processing and environment variable-based configuration
  • Updated dependency management and build configuration across multiple crates

Reviewed Changes

Copilot reviewed 45 out of 49 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
scripts/run.sh Updated logging configuration and added multiple webhook notification targets
rustfs/src/main.rs Updated global configuration variable references to use new naming convention
rustfs/src/config/mod.rs Updated default value reference for console enable configuration
rustfs/src/admin/mod.rs Added new notification target management API endpoints
rustfs/src/admin/handlers/event.rs Updated imports and configuration key references
crates/utils/src/dirs.rs Added comprehensive log directory resolution functionality
crates/protos/src/main.rs Updated protobuf build configuration and dependency
crates/protos/Cargo.toml Replaced tonic-build with tonic-prost-build
crates/obs/src/telemetry.rs Updated log directory configuration to use new utility functions
crates/obs/src/sinks/mod.rs Updated default value references and improved configuration handling
crates/obs/src/sinks/file.rs Enhanced file sink logging with path information
crates/obs/src/config.rs Major refactor to use environment variable constants and improved configuration management
crates/obs/Cargo.toml Updated feature dependencies
crates/notify/src/target/mod.rs Added boolean parsing utility function
crates/notify/src/registry.rs Complete refactor of target creation to support concurrent processing and environment variable merging
crates/notify/src/integration.rs Commented out configuration saving and updated target creation comments
crates/notify/src/factory.rs Simplified factory implementations to use merged configuration directly
crates/notify/src/error.rs Added new error types and fixed import
crates/notify/examples/ Updated imports to use new configuration constants
crates/notify/Cargo.toml Added futures dependency and reordered dependencies
crates/mcp/Cargo.toml Updated dependencies to use workspace versions
crates/ecstore/src/store.rs Updated global storage class variable reference
crates/ecstore/src/set_disk.rs Updated global storage class references and improved imports
crates/ecstore/src/global.rs Removed unused constant and updated lazy_static usage
crates/ecstore/src/config/ Replaced lazy_static with LazyLock across all configuration modules
crates/e2e_test/Cargo.toml Updated dependencies to use workspace versions
crates/config/src/observability/ Restructured observability configuration to use constants instead of structs
crates/config/src/notify/ Added valid field collections for webhook and MQTT targets
crates/config/src/constants/app.rs Updated application name and added console enable default
crates/config/Cargo.toml Removed unused serde dependencies
crates/checksums/Cargo.toml Updated dependencies to use workspace versions
Cargo.toml Updated workspace dependencies and added cargo-shear metadata

@houseme houseme merged commit c5df1f9 into main Jul 30, 2025
11 of 12 checks passed
@houseme houseme deleted the feature/event-api branch July 30, 2025 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants