Module adapter

Module adapter 

Source
Expand description

通用适配器:JSON ↔ Protobuf 转换 + 请求分发

核心思路:

  1. HTTP 请求带 JSON body → 反序列化为 prost Message → encode 为 bytes
  2. 构造 IncomingRequest { proto_id, body } → 调用 RequestRouter::dispatch
  3. 响应 bytes → decode 为 prost Message → 序列化为 JSON 返回

Structs§

ApiResponse
通用响应格式(包装 proto 响应,加 ret_type/ret_msg)
RestState
REST 服务共享状态

Functions§

proto_request
通用 protobuf 请求-响应适配器