Centralize program branding helpers#1329
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// Returns the canonical client program name for upstream-compatible binaries. | ||
| #[must_use] | ||
| pub const fn client_program_name() -> &'static str { | ||
| CLIENT_PROGRAM_NAME | ||
| } | ||
|
|
||
| /// Returns the canonical daemon program name for upstream-compatible binaries. | ||
| #[must_use] | ||
| pub const fn daemon_program_name() -> &'static str { | ||
| DAEMON_PROGRAM_NAME | ||
| } | ||
|
|
||
| /// Returns the branded client program name exposed as `oc-rsync`. | ||
| #[must_use] | ||
| pub const fn oc_client_program_name() -> &'static str { | ||
| OC_CLIENT_PROGRAM_NAME | ||
| } | ||
|
|
||
| /// Returns the branded daemon program name exposed as `oc-rsyncd`. | ||
| #[must_use] | ||
| pub const fn oc_daemon_program_name() -> &'static str { | ||
| OC_DAEMON_PROGRAM_NAME |
There was a problem hiding this comment.
Remove duplicate branding accessors and undefined constants
The new helpers expose client_program_name() and daemon_program_name() but both return CLIENT_PROGRAM_NAME/DAEMON_PROGRAM_NAME, constants that are not defined anywhere in the crate. In the same block, oc_client_program_name() and oc_daemon_program_name() are defined a second time, duplicating the existing functions above. These missing constants and duplicate definitions prevent rsync-core from compiling. Reuse the existing UPSTREAM_* constants (or rename the original helpers) instead of referencing non‑existent names, and avoid redeclaring the oc_* accessors.
Useful? React with 👍 / 👎.
| pub const fn version_metadata() -> VersionMetadata { | ||
| version_metadata_for_program(PROGRAM_NAME) | ||
| version_metadata_for_program(client_program_name()) | ||
| } | ||
|
|
||
| /// Returns metadata configured for the upstream-compatible `rsync` daemon banner. | ||
| #[must_use] | ||
| pub const fn daemon_version_metadata() -> VersionMetadata { | ||
| version_metadata_for_program(daemon_program_name()) | ||
| } | ||
|
|
||
| /// Returns metadata configured for the branded `oc-rsync` client banner. | ||
| #[must_use] | ||
| pub const fn oc_version_metadata() -> VersionMetadata { | ||
| version_metadata_for_program(oc_client_program_name()) | ||
| } | ||
|
|
||
| /// Returns metadata configured for the branded `oc-rsyncd` daemon banner. | ||
| #[must_use] | ||
| pub const fn oc_daemon_version_metadata() -> VersionMetadata { | ||
| version_metadata_for_program(oc_daemon_program_name()) |
There was a problem hiding this comment.
Qualify branding helpers used by version metadata
The new metadata functions invoke client_program_name(), daemon_program_name(), oc_client_program_name(), and oc_daemon_program_name() directly, but these functions live in the branding module and are not imported into version.rs. As written, the calls refer to undefined functions and will fail to compile even after the branding module builds. Reference them as branding::client_program_name() (and the other variants) or add explicit use crate::branding::{…} statements before calling them.
Useful? React with 👍 / 👎.
Replace Mutex<Vec<Vec<u8>>> with crossbeam_queue::ArrayQueue for lock-free concurrent buffer pool access. ArrayQueue uses CAS operations instead of mutex locking, eliminating contention on hot paths in parallel_checksum.rs (rayon workers) and execute.rs (file transfer). - pop() returns None when empty (allocate fresh buffer) - push() returns Err when full (drop excess buffer) - No mutex poisoning possible - crossbeam-queue already proven in crates/transfer/src/pipeline/spsc.rs Closes #1329
Replace Mutex<Vec<Vec<u8>>> with crossbeam_queue::ArrayQueue for lock-free concurrent buffer pool access. ArrayQueue uses CAS operations instead of mutex locking, eliminating contention on hot paths in parallel_checksum.rs (rayon workers) and execute.rs (file transfer). - pop() returns None when empty (allocate fresh buffer) - push() returns Err when full (drop excess buffer) - No mutex poisoning possible - crossbeam-queue already proven in crates/transfer/src/pipeline/spsc.rs Closes #1329
Replace Mutex<Vec<Vec<u8>>> with crossbeam_queue::ArrayQueue for lock-free concurrent buffer pool access. ArrayQueue uses CAS operations instead of mutex locking, eliminating contention on hot paths in parallel_checksum.rs (rayon workers) and execute.rs (file transfer). - pop() returns None when empty (allocate fresh buffer) - push() returns Err when full (drop excess buffer) - No mutex poisoning possible - crossbeam-queue already proven in crates/transfer/src/pipeline/spsc.rs Closes #1329
…2923) Replace Mutex<Vec<Vec<u8>>> with crossbeam_queue::ArrayQueue for lock-free concurrent buffer pool access. ArrayQueue uses CAS operations instead of mutex locking, eliminating contention on hot paths in parallel_checksum.rs (rayon workers) and execute.rs (file transfer). - pop() returns None when empty (allocate fresh buffer) - push() returns Err when full (drop excess buffer) - No mutex poisoning possible - crossbeam-queue already proven in crates/transfer/src/pipeline/spsc.rs Closes #1329
…2923) Replace Mutex<Vec<Vec<u8>>> with crossbeam_queue::ArrayQueue for lock-free concurrent buffer pool access. ArrayQueue uses CAS operations instead of mutex locking, eliminating contention on hot paths in parallel_checksum.rs (rayon workers) and execute.rs (file transfer). - pop() returns None when empty (allocate fresh buffer) - push() returns Err when full (drop excess buffer) - No mutex poisoning possible - crossbeam-queue already proven in crates/transfer/src/pipeline/spsc.rs Closes #1329
…2923) Replace Mutex<Vec<Vec<u8>>> with crossbeam_queue::ArrayQueue for lock-free concurrent buffer pool access. ArrayQueue uses CAS operations instead of mutex locking, eliminating contention on hot paths in parallel_checksum.rs (rayon workers) and execute.rs (file transfer). - pop() returns None when empty (allocate fresh buffer) - push() returns Err when full (drop excess buffer) - No mutex poisoning possible - crossbeam-queue already proven in crates/transfer/src/pipeline/spsc.rs Closes #1329
Propose promoting the single-slot thread_local cache (#1329) into a fixed-depth per-thread cache to keep most acquire/return cycles off the shared ArrayQueue, with overflow falling through to the existing pool. Documents the idle-memory trade-off and cites the sharded-queue alternative in #1271 as fallback.
Propose promoting the single-slot thread_local cache (#1329) into a fixed-depth per-thread cache to keep most acquire/return cycles off the shared ArrayQueue, with overflow falling through to the existing pool. Documents the idle-memory trade-off and cites the sharded-queue alternative in #1271 as fallback.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_69009195ee08832384297ba41d969102