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等)预留空间。
This commit is contained in:
67
api/grpc/record.proto
Normal file
67
api/grpc/record.proto
Normal file
@@ -0,0 +1,67 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package record;
|
||||
|
||||
option go_package = "go.yandata.net/iod/iod/trustlog-sdk/api/grpc/pb;pb";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "common.proto";
|
||||
|
||||
|
||||
// ======================== 公共数据结构 ========================
|
||||
message RecordData {
|
||||
// 记录核心信息
|
||||
string id = 1; // 记录唯一标识符(必填)
|
||||
string do_prefix = 2; // 数据前缀标识符
|
||||
string producer_id = 3; // 生产者ID
|
||||
google.protobuf.Timestamp timestamp = 4;// 记录时间戳
|
||||
string operator = 5; // 操作执行者标识
|
||||
bytes extra = 6; // 额外数据字段
|
||||
string rc_type = 7; // 记录类型
|
||||
}
|
||||
|
||||
|
||||
// ======================== 列表查询请求 & 返回 ========================
|
||||
message ListRecordReq {
|
||||
// 分页条件
|
||||
uint64 page_size = 1; // 页面大小
|
||||
google.protobuf.Timestamp pre_time = 2; // 上一页最后一个时间
|
||||
|
||||
// 可选过滤条件
|
||||
string do_prefix = 3; // 数据前缀过滤
|
||||
string rc_type = 4; // 记录类型过滤
|
||||
}
|
||||
|
||||
message ListRecordRes {
|
||||
int64 count = 1; // 数据总量
|
||||
repeated RecordData data = 2; // 记录数据列表
|
||||
}
|
||||
|
||||
|
||||
// ======================== 记录验证请求 & 流式响应 ========================
|
||||
message RecordValidationReq {
|
||||
google.protobuf.Timestamp timestamp = 1;// 记录时间戳
|
||||
string record_id = 2; // 要验证的记录ID
|
||||
string do_prefix = 3; // 数据前缀(可选)
|
||||
string rc_type = 4; // 记录类型
|
||||
}
|
||||
|
||||
message RecordValidationStreamRes {
|
||||
int32 code = 1; // 状态码(100处理中,200完成,400客户端错误,500服务器错误)
|
||||
string msg = 2; // 消息描述
|
||||
string progress = 3; // 验证进度(如 "30%", "验证哈希完成")
|
||||
|
||||
// 验证结果详情(仅在完成时返回)
|
||||
RecordData result = 4;
|
||||
common.Proof proof = 5; // 取证证明(仅在完成时返回)
|
||||
}
|
||||
|
||||
|
||||
// ======================== gRPC 服务定义 ========================
|
||||
service RecordValidationService {
|
||||
// 分页查询记录列表
|
||||
rpc ListRecords (ListRecordReq) returns (ListRecordRes);
|
||||
|
||||
// 单个记录验证,服务端流式返回验证进度与结果
|
||||
rpc ValidateRecord (RecordValidationReq) returns (stream RecordValidationStreamRes);
|
||||
}
|
||||
Reference in New Issue
Block a user