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 以优化大文件传输。
This commit is contained in:
14
docs/protocol_v2.md
Normal file
14
docs/protocol_v2.md
Normal file
@ -0,0 +1,14 @@
|
||||
# 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` 统一映射。
|
Reference in New Issue
Block a user