Skip to content

Refactor ruapc into modular crates with trait-based transport abstractions#32

Closed
Copilot wants to merge 8 commits intomainfrom
copilot/refactor-ruapc-core-code
Closed

Refactor ruapc into modular crates with trait-based transport abstractions#32
Copilot wants to merge 8 commits intomainfrom
copilot/refactor-ruapc-core-code

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Splits monolithic ruapc into independent crates with trait-based socket/socket-pool abstractions. Enables per-transport versioning and dependency selection.

New Crates

  • ruapc-coreError, Message, Payload, MsgMeta, SendMsg
  • ruapc-asyncTaskSupervisor, TaskSupervisorGuard
  • ruapc-transportRuapcSocket, RuapcSocketPool, MessageHandler traits
  • ruapc-tcp — TCP transport (TcpSocket, TcpSocketPool)
  • ruapc-ws — WebSocket transport (WebSocket, WebSocketPool)
  • ruapc-http — HTTP transport with RapiDoc serving (HttpSocket, HttpSocketPool)

Architecture

ruapc-core        ← fundamental types
ruapc-async       ← async utilities (tokio only)
ruapc-transport   ← trait definitions
    ↑
ruapc-{tcp,ws,http}  ← transport implementations
    ↑
ruapc             ← RPC framework (Router, Context, Client, Server)

Key Traits

#[async_trait]
pub trait RuapcSocket: Send + Sync {
    async fn send(&self, meta: MsgMeta, payload: Bytes) -> Result<()>;
}

#[async_trait]
pub trait RuapcSocketPool: Send + Sync {
    fn socket_type(&self) -> SocketType;
    async fn get_socket(&self, addr: &str) -> Result<Arc<dyn RuapcSocket>>;
    async fn start_server(&self, addr: &str, handler: Arc<dyn MessageHandler>) -> Result<()>;
}

Backward Compatibility

Main ruapc crate re-exports all transport crates—existing code works unchanged.

Original prompt

对 ruapc 核心代码进行一次完整重构,合理地拆分为数个独立的 crate,使其架构更清晰。单元测试环境的配置可以参考 workflows 中的 CI 文件。


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 4, 2026 15:49
Co-authored-by: SF-Zhou <7477599+SF-Zhou@users.noreply.github.com>
Co-authored-by: SF-Zhou <7477599+SF-Zhou@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor core code of ruapc into separate crates Refactor: Extract core types into ruapc-core crate Feb 4, 2026
Copilot AI requested a review from SF-Zhou February 4, 2026 15:59
Co-authored-by: SF-Zhou <7477599+SF-Zhou@users.noreply.github.com>
Copilot AI changed the title Refactor: Extract core types into ruapc-core crate Refactor: Split ruapc into ruapc-core and ruapc-async crates Feb 5, 2026
Copilot AI and others added 4 commits February 5, 2026 01:59
…abstractions

Co-authored-by: SF-Zhou <7477599+SF-Zhou@users.noreply.github.com>
Co-authored-by: SF-Zhou <7477599+SF-Zhou@users.noreply.github.com>
…d compatibility

Co-authored-by: SF-Zhou <7477599+SF-Zhou@users.noreply.github.com>
Co-authored-by: SF-Zhou <7477599+SF-Zhou@users.noreply.github.com>
Copilot AI changed the title Refactor: Split ruapc into ruapc-core and ruapc-async crates Refactor ruapc into modular crates with trait-based transport abstractions Feb 5, 2026
@SF-Zhou SF-Zhou closed this Feb 6, 2026
@SF-Zhou SF-Zhou deleted the copilot/refactor-ruapc-core-code branch February 8, 2026 11:20
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.

2 participants