Files
go-trustlog/api/grpc/operation.proto
ryan d313449c5c refactor: 重构trustlog-sdk目录结构到trustlog/go-trustlog
- 将所有trustlog-sdk文件移动到trustlog/go-trustlog/目录
- 更新README中所有import路径从trustlog-sdk改为go-trustlog
- 更新cookiecutter配置文件中的项目名称
- 更新根目录.lefthook.yml以引用新位置的配置
- 添加go.sum文件到版本控制
- 删除过时的示例文件

这次重构与trustlog-server保持一致的目录结构,
为未来支持多语言SDK(Python、Java等)预留空间。
2025-12-22 13:37:57 +08:00

73 lines
2.7 KiB
Protocol Buffer
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.
syntax = "proto3";
package operation;
option go_package = "go.yandata.net/iod/iod/trustlog-sdk/api/grpc/pb;pb";
import "google/protobuf/timestamp.proto";
import "common.proto";
// ======================== 公共数据结构 ========================
message OperationData {
// 操作元数据信息
string op_id = 1; // 操作唯一标识符
google.protobuf.Timestamp timestamp = 2;// 操作时间戳
string op_source = 3; // 操作来源系统
string op_type = 4; // 操作类型
string do_prefix = 5; // 数据前缀标识符
string do_repository = 6; // 数据仓库标识符
string doid = 7; // 数据对象唯一标识
string producer_id = 8; // 生产者ID
string op_actor = 9; // 操作执行者信息
string request_body_hash = 10; // 请求体哈希值(可选)
string response_body_hash = 11; // 响应体哈希值(可选)
}
// ======================== 验证请求 & 流式响应 ========================
message ValidationReq {
google.protobuf.Timestamp time = 1; // 操作时间戳(ISO8601格式)
string op_id = 2; // 操作唯一标识符
string op_type = 3; // 操作类型
string do_repository = 4; // 数据仓库标识
}
message ValidationStreamRes {
int32 code = 1; // 状态码100处理中200完成500失败
string msg = 2; // 消息描述
string progress = 3; // 当前进度(比如 "50%"
OperationData data = 4; // 最终完成时返回,过程可为空
common.Proof proof = 5; // 取证证明(仅在完成时返回)
}
// ======================== 列表查询请求 & 返回 ========================
message ListOperationReq {
// 分页条件
uint64 page_size = 1; // 页面大小
google.protobuf.Timestamp pre_time = 2; //上一页最后一个时间
// 可选条件
google.protobuf.Timestamp timestamp = 3;// 操作时间戳
string op_source = 4; // 操作来源
string op_type = 5; // 操作类型
string do_prefix = 6; // 数据前缀
string do_repository = 7; // 数据仓库
}
message ListOperationRes {
int64 count=1; // 数据总量
repeated OperationData data = 2; // 数据列表
}
// ======================== gRPC 服务定义 ========================
service OperationValidationService {
// 单个请求,服务端流式返回进度与最终结果
rpc ValidateOperation (ValidationReq) returns (stream ValidationStreamRes);
// 分页查询操作记录
rpc ListOperations (ListOperationReq) returns (ListOperationRes);
}