mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[PR #748] [MERGED] [Store] Refine Complicated Constructor Parameters #1791
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1791
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/Mooncake/pull/748
Author: @ykwd
Created: 8/15/2025
Status: ✅ Merged
Merged: 8/18/2025
Merged by: @ykwd
Base:
main← Head:dev/store-config-refine📝 Commits (10+)
c17273eRefactor configs769cb28Add validation logic5752dd6Refactor codes1128b0cAdd MasterServiceConfigBuildera6b040dchores1ebecf1Format code96f3ee5Use consistent variable name94ae19cFix unit testsc539286Minor fixcbd477cFormat code📊 Changes
13 files changed (+705 additions, -270 deletions)
View changed files
➖
mooncake-store/include/config.h(+0 -33)➕
mooncake-store/include/config_helper.h(+98 -0)📝
mooncake-store/include/ha_helper.h(+3 -49)➕
mooncake-store/include/master_config.h(+377 -0)📝
mooncake-store/include/master_service.h(+3 -16)📝
mooncake-store/include/rpc_service.h(+2 -15)📝
mooncake-store/src/ha_helper.cpp(+14 -42)📝
mooncake-store/src/master.cpp(+5 -18)📝
mooncake-store/src/master_service.cpp(+16 -21)📝
mooncake-store/src/rpc_service.cpp(+6 -16)📝
mooncake-store/tests/master_metrics_test.cpp(+10 -6)📝
mooncake-store/tests/master_service_ssd_test.cpp(+1 -11)📝
mooncake-store/tests/master_service_test.cpp(+170 -43)📄 Description
For classes like
WrappedMasterService,MasterServiceSupervisor, andMasterService, the number of constructor parameters has gradually grown to a dozen or more. This makes adding new parameters or modifying existing ones increasingly cumbersome. It also becomes difficult to maintain consistency across the codebase—especially when some parameters have default values while others do not.For example, in
master_metrics_test.cpp, the following code became outdated without notice when the third parameter was replaced with anotherintparameter (the original one is enable_metric_reporting):This PR addresses these issues by introducing a dedicated config class for each of the three classes mentioned above. All required parameters are defined within the config class, allowing them to be set by name rather than by position. It also clearly distinguishes between parameters with and without default values. For the latter, the config class enforces that a value must be explicitly set before use. Additionally, with named parameter settings, it also becomes easier to set a subset of parameters with non-default values.
With this PR, the following code can be simplified and well-maintained:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.