Files
wls_vfs/docs/protocol_v2.md
ekko.bao d2b98b4020 feat(proto/server)!: 升级至协议 v2(统一错误模型);全面替换 Request/Response 并移除 ret
- Breaking change: 协议不向后兼容,旧客户端需同步升级
- Proto: 新增 FsOp/ErrorCause/FsError/RpcStatus;为所有 FS 接口定义 <Op>Request/<Op>Response;删除历史 ret 字段
- Server: 所有 RPC 返回统一的 RpcStatus;成功 ok=true,失败填充 FsError(operation/paths/sys_msg 等)
  - Open/Read/Write 对齐新字段(fi/data/written);Readdir/Opendir/Releasedir 等返回类型调整
  - Rename 传回 from/to;OpendirRequest 不再输入 fi,服务端生成并回传
- Docs: 新增 docs/protocol_v2.md;README 标注 v2 破坏性升级与用法
- Build: 主要面向 Windows(winapi)。Linux 环境类型检查可能失败

后续:完善 errno 抽取与 context 填充;可选引入流式 read/write 以优化大文件传输。
2025-09-23 21:25:06 +08:00

15 lines
659 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# LWS 协议 v2统一错误模型
- RpcStatus { ok, error }
- FsError { code, message, sys_msg, grpc_code, grpc_message, operation(FsOp), paths[], context{...}, causes[], server, timestamp_ms, retriable }
成功ok = true失败ok = false 且 error.code 为正数 POSIX errno。
常用 context keys: flags, offset, size, uid, gid, mode, fh, mask, xattr_name, xattr_size。
FsOp 与 RPC 映射:与客户端 docs 相同(参见 proto/lws.proto 中的 service 定义)。
服务端返回建议:
- 失败时设置 error.code 与 sys_msg并补充 operation/paths/context。
- 传输层错误由客户端据 gRPC `Status` 统一映射。