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; // 操作来源系统 int32 op_code = 4; // 操作代码(int32) 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; // 操作唯一标识符 int32 op_code = 3; // 操作代码(int32) 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; // 操作来源 int32 op_code = 5; // 操作代码(int32) 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); }