[Refactor♻️] Rename BackendOps to MessageStoreEngine in rocketmq-store
Target Code
Package: rocketmq-store. Start at rocketmq-store/src/base/backend_ops.rs, where BackendOps extends MessageStoreReader.
File checklist:
| File | Change |
|---|---|
rocketmq-store/src/base/backend_ops.rs |
Rename the trait, self-referencing generic bounds, and Rustdoc links; clarify its internal engine contract. |
rocketmq-store/src/capability.rs |
Update imports, bounds, blanket implementations, qualified calls, and documentation. |
rocketmq-store/src/capability/read.rs |
Update qualified calls, including those in tests. |
rocketmq-store/src/message_store.rs |
Update the trait import, implementation, and generic bounds. |
rocketmq-store/src/message_store/local_file_message_store.rs |
Update the trait import, implementation, and generic bounds. |
rocketmq-store/src/message_store/rocksdb_message_store.rs |
Update the trait import, implementation, and generic bounds. |
rocketmq-store/src/factory.rs |
Update the trait import used for engine methods. |
rocketmq-store/src/test_support.rs |
Update the trait import. |
rocketmq-store/src/log_file/commit_log.rs |
Update the test import. |
rocketmq-store/src/timer/timer_message_store.rs |
Update the test import. |
rocketmq-store/src/ha/default_ha_client.rs |
Update the test import. |
rocketmq-store/src/ha/auto_switch/auto_switch_ha_service.rs |
Update the test import. |
rocketmq-store/tests/message_store/local_file_message_store/unit.rs |
Update the import and qualified calls. |
rocketmq-store/tests/public_api_cutover_tests.rs |
Make the existing internal-interface boundary checks cover the new name. |
rocketmq-doc/en/remediation/2026-09-08-internal-boundaries.md |
Update the current trait name in the Store backend reads section. |
Problems
BackendOps is a generic abbreviation that does not identify the message-store domain or explain the contract's responsibility. The trait combines logical reads with message writes, lifecycle, administration, and replication operations. It is implementation glue for concrete store engines, while Broker consumers use narrower capability interfaces.
MessageStoreEngine makes that responsibility explicit and pairs naturally with the existing MessageStoreReader supertrait.
Proposed Changes
This is a mechanical naming cleanup suitable for a first contribution. The target name is MessageStoreEngine; choosing or redesigning the interface is outside this task.
Rename the trait and update the file checklist above:
// Before
pub trait BackendOps: MessageStoreReader + Send + Sync + 'static {
// After
pub trait MessageStoreEngine: MessageStoreReader + Send + Sync + 'static {
Update imports, impl blocks, generic bounds, fully qualified calls such as BackendOps::load(...), and Rustdoc links. Document that the trait is the internal implementation contract for message-store engines and that Broker consumers continue to use narrow capability ports.
Keep the backend_ops.rs filename and backend_ops module name unchanged. Preserve all method signatures, default implementations, supertraits, trait attributes, runtime ownership, error handling, feature gates, and storage/wire behavior. The module is pub(crate); keep that visibility and do not re-export the renamed trait or add a compatibility alias.
Update the existing source-contract tests to reject public exports and direct Broker bounds using MessageStoreEngine. Retain their protection against the old BackendOps name. Do not delete assertions merely to make tests pass.
Avoid blanket substring replacement: the historical LocalFileBackendOps rejection assembled in rocketmq-store/src/ha/ha_connection_state_notification_service.rs is a separate legacy guard and should remain unchanged.
Acceptance criteria:
- [ ] The trait and all live Rust references use
MessageStoreEngine. - [ ] Documentation and Rustdoc links use the new name.
- [ ] Remaining old-name occurrences are limited to intentional legacy rejection checks.
- [ ] The engine contract remains internal; Broker capability interfaces remain unchanged.
- [ ] Default and RocksDB-enabled implementations compile, and the focused checks below pass.
- [ ] The diff contains only the rename, related documentation, and updates to existing boundary assertions.
Run from the repository root:
cargo fmt -p rocketmq-store -- --check
cargo test -p rocketmq-store --lib base::backend_ops::tests
cargo test -p rocketmq-store --test public_api_cutover_tests --test capability_conformance_tests
cargo test -p rocketmq-store --features rocksdb_store --lib base::backend_ops::tests
git diff --check
The default checks cover the build without the optional RocksDB engine; the last Cargo command compiles the renamed RocksDB implementation and its unit-test code. RocksDB builds require the native build prerequisites documented in the repository README. These commands are contributor validation steps and were not run during issue preparation.
Reuse existing tests; no additional test that merely checks the renamed identifier is required. To claim this issue, leave a comment before starting your pull request.
@mxsm I'd like to take this one. Plan, following the checklist:
- Rename
BackendOpstoMessageStoreEngineacross the listed files (impls, generic bounds, fully qualified calls likeMessageStoreEngine::load(...), Rustdoc links), and document it as the internal engine contract that Broker code does not bound on directly. - Keep the
backend_ops.rsfile and module name, and leave the legacyLocalFileBackendOpsrejection inha_connection_state_notification_service.rsuntouched (no blanket substring replace). - Extend the existing boundary checks in
public_api_cutover_tests.rsto rejectMessageStoreEngineexports and direct Broker bounds, while keeping theBackendOpsguard. - Update the remediation doc, then run the focused checks for default and
rocksdb_storefeatures.