mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[PR #562] [MERGED] refactor: introduce expected pattern for error handling in master service #1653
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#1653
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/562
Author: @xiaguan
Created: 6/26/2025
Status: ✅ Merged
Merged: 7/3/2025
Merged by: @xiaguan
Base:
main← Head:master_expected📝 Commits (10+)
8643435refactor: introduce expected pattern for error handling in master servicec34f5c4Refactor error handling to use expected<T,E> pattern instead of ErrorCode0302716fix test compilea61e14drefactor: update client implementation and remove master.protoa2005d2fix: update Python integration to work with new batch APIa9f1a5drefine master log and metric3d0196ffix(ci): should alloc first4cd8851Merge branch 'main' into master_expected2ae4bb6merge mainde2d387fix tests📊 Changes
25 files changed (+2814 additions, -2119 deletions)
View changed files
📝
.gitignore(+3 -0)📝
mooncake-integration/store/store_py.cpp(+296 -187)📝
mooncake-integration/store/store_py.h(+7 -2)📝
mooncake-store/include/cachelib_memory_allocator/Slab.h(+1 -1)📝
mooncake-store/include/client.h(+69 -60)📝
mooncake-store/include/master_client.h(+53 -48)📝
mooncake-store/include/master_metric_manager.h(+36 -0)📝
mooncake-store/include/master_service.h(+61 -50)➕
mooncake-store/include/rpc_helper.h(+60 -0)📝
mooncake-store/include/rpc_service.h(+299 -366)📝
mooncake-store/include/types.h(+4 -3)📝
mooncake-store/include/utils.h(+73 -1)📝
mooncake-store/include/utils/scoped_vlog_timer.h(+37 -6)➖
mooncake-store/proto/master.proto(+0 -225)📝
mooncake-store/src/client.cpp(+650 -366)📝
mooncake-store/src/master_client.cpp(+229 -263)📝
mooncake-store/src/master_metric_manager.cpp(+106 -0)📝
mooncake-store/src/master_service.cpp(+151 -161)📝
mooncake-store/tests/client_integration_test.cpp(+129 -75)📝
mooncake-store/tests/e2e/client_wrapper.cpp(+21 -13)...and 5 more files
📄 Description
Overview
This PR introduces the
tl::expectedpattern for error handling in the master service, replacing traditionalErrorCodereturn types with a more type-safe and explicit approach.Changes
Core Improvements
ErrorCodereturn types withtl::expected<T, ErrorCode>pattern.value().error()Modified Components
expected<void, ErrorCode>orexpected<T, ErrorCode>ylt/util/expected.hppFiles Changed
mooncake-store/include/master_service.h- Updated method signaturesmooncake-store/include/rpc_service.h- RPC interface adaptationsmooncake-store/include/types.h- Minor formatting improvementsmooncake-store/src/master_service.cpp- Implementation updatesmooncake-store/tests/- Comprehensive test updatesBenefits
Future Work
This PR lays the groundwork for:
Testing
All existing tests have been updated and continue to pass, ensuring backward compatibility and correctness of the new error handling approach.
Note: This change maintains API compatibility while improving error handling semantics. The expected pattern provides a modern, type-safe approach to error handling that will benefit future development and maintenance.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.