Skip to content

[refactor] Refactor kv rpc dispatch - #147

Merged
ji-huazhong merged 1 commit into
Ascend:mainfrom
ji-huazhong:refactor-kv-rpc-dispatch
Aug 8, 2026
Merged

[refactor] Refactor kv rpc dispatch#147
ji-huazhong merged 1 commit into
Ascend:mainfrom
ji-huazhong:refactor-kv-rpc-dispatch

Conversation

@ji-huazhong

@ji-huazhong ji-huazhong commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Background

There is a substantial amount of duplicated implementation logic between the current KV interface and Controller‑side RPC:

  • Identical business logic is maintained separately for the synchronous and asynchronous KV APIs.
  • The Client re‑implements Controller request construction, transmission, reception and response validation repeatedly.
  • The Controller relies on lengthy if/elif branches to dispatch different requests, resulting in high maintenance overhead.

Changes Made

  • Make the asynchronous KV API the sole high‑level implementation. Synchronous APIs invoke their asynchronous counterparts via the client’s background event‑loop.
  • Add a unified Controller RPC request method to centralise message sending, reception, logging and response type validation.
  • Refactor Controller request dispatching to use explicit handler mapping.
  • Extract shared response‑building logic and consolidate performance metrics collection within the dispatch layer.
  • Approximately 305 lines of redundant code have been removed in net terms.

Compatibility

This commit only refactors internal implementations and introduces no alterations to:

  • Public synchronous and asynchronous APIs
  • ZMQ request and response types
  • Response data schemas
  • Controller metric names
  • Storage‑backend and distributed‑system behaviour

@ji-huazhong
ji-huazhong force-pushed the refactor-kv-rpc-dispatch branch from 941e876 to d400f69 Compare August 8, 2026 12:03
@ji-huazhong ji-huazhong changed the title Refactor kv rpc dispatch [refactor] Refactor kv rpc dispatch Aug 8, 2026
@ji-huazhong
ji-huazhong force-pushed the refactor-kv-rpc-dispatch branch from d400f69 to 61342d0 Compare August 8, 2026 12:37
@ji-huazhong
ji-huazhong requested a review from 0oshowero0 August 8, 2026 12:39
@ji-huazhong
ji-huazhong force-pushed the refactor-kv-rpc-dispatch branch from 61342d0 to 8bd5a91 Compare August 8, 2026 13:11
Signed-off-by: ji-huazhong <hzji210@gmail.com>
@ji-huazhong
ji-huazhong force-pushed the refactor-kv-rpc-dispatch branch from 8bd5a91 to 843f6be Compare August 8, 2026 13:22
@ji-huazhong
ji-huazhong merged commit 750719e into Ascend:main Aug 8, 2026
8 checks passed
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.

1 participant