2025-05-22 06:26:07 +00:00
|
|
|
|
syntax = "proto3";
|
|
|
|
|
package files;
|
|
|
|
|
|
|
|
|
|
option go_package = "./;files";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
service File{
|
|
|
|
|
rpc List(FileListReq) returns (FileListResp) {} // 获取当前路径下的文件列表
|
2025-05-23 02:35:22 +00:00
|
|
|
|
rpc Info(FileInfoReq) returns (FileInfoResp) {} // 获取文件信息
|
2025-05-22 06:26:07 +00:00
|
|
|
|
rpc Create(CreateReq) returns (CreateResp) {} // 创建文件夹
|
|
|
|
|
rpc Delete(DeleteReq) returns (DeleteResp) {} // 删除文件或文件夹
|
|
|
|
|
rpc Search(searchReq) returns (searchResp) {} // 搜索
|
2025-05-22 08:23:11 +00:00
|
|
|
|
rpc Upload(UploadReq) returns (UploadResp) {} // 文件上传
|
2025-05-30 08:17:28 +00:00
|
|
|
|
rpc TusCreate(TusCreateReq) returns (TusCreateResp) {} // 分块文件上传:创建文件
|
|
|
|
|
rpc TusUpload(TusUploadReq) returns (TusUploadResp) {} // 分块文件上传:上传文件块
|
|
|
|
|
rpc ResumableTransfer(ResumableTransferReq) returns (ResumableTransferResp) {} // 断点续传的grpc实现
|
|
|
|
|
rpc Preview(PreviewReq) returns (PreviewResp) {} // 文件预览
|
|
|
|
|
rpc Action(ActionReq) returns (ActionResp) {} // 移动文件或重命名文件
|
2025-06-03 02:50:42 +00:00
|
|
|
|
rpc DirDownload(DirDownloadReq) returns (stream DirDownloadResp) {} // 文件夹压缩下载
|
2025-05-22 06:26:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message FileListReq{
|
|
|
|
|
string path = 1; // 目标文件夹路径
|
2025-05-30 08:17:28 +00:00
|
|
|
|
string userSpacePath = 2; // 用户空间的路径
|
2025-05-22 06:26:07 +00:00
|
|
|
|
Sorting sorting = 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message Items {
|
|
|
|
|
string path = 1;
|
|
|
|
|
string name = 2;
|
|
|
|
|
int64 size = 3;
|
|
|
|
|
string extension = 4;
|
|
|
|
|
string modified = 5;
|
|
|
|
|
string mode = 6;
|
|
|
|
|
bool isDir = 7;
|
|
|
|
|
bool isSymlink = 8;
|
|
|
|
|
string type = 9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message Sorting {
|
|
|
|
|
string by = 1;
|
|
|
|
|
bool asc = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message FileListResp {
|
|
|
|
|
repeated Items items = 1;
|
|
|
|
|
int32 numDirs = 2;
|
|
|
|
|
int32 numFiles = 3;
|
|
|
|
|
Sorting sorting = 4;
|
|
|
|
|
string path = 5;
|
|
|
|
|
string name = 6;
|
|
|
|
|
int64 size = 7;
|
|
|
|
|
string extension = 8;
|
|
|
|
|
string modified = 9;
|
|
|
|
|
string mode = 10;
|
|
|
|
|
bool isDir = 11;
|
|
|
|
|
bool isSymlink = 12;
|
|
|
|
|
string type = 13;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message CreateReq{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message CreateResp{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message DeleteReq{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message DeleteResp{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message UploadReq{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
bytes content =3;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message UploadResp{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message searchReq{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
string query = 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message searchResp{
|
|
|
|
|
message Nested {
|
|
|
|
|
bool dir = 1;
|
|
|
|
|
string path = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
repeated Nested items = 1;
|
2025-05-22 08:23:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message TusCreateReq{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
bool override =3 ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message TusCreateResp{
|
|
|
|
|
int64 uploadLength = 1;
|
|
|
|
|
int64 uploadOffset = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message TusUploadReq{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
int64 uploadOffset = 3;
|
|
|
|
|
bytes content = 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message TusUploadResp{
|
|
|
|
|
int64 uploadOffset = 1;
|
2025-05-23 02:35:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message ResumableTransferReq{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
int64 offset = 3;
|
|
|
|
|
int64 length = 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message ResumableTransferResp{
|
|
|
|
|
bytes content = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message FileInfoReq{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message FileInfoResp{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string name = 2;
|
|
|
|
|
int64 size = 3;
|
|
|
|
|
string extension = 4;
|
|
|
|
|
string modified = 5;
|
|
|
|
|
string mode = 6;
|
|
|
|
|
bool isDir = 7;
|
|
|
|
|
bool isSymlink = 8;
|
|
|
|
|
string type = 9;
|
2025-05-26 03:03:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message PreviewReq{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
uint32 size = 3; // 预览大小 0:256x256, 1:1080x1080
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message PreviewResp{
|
|
|
|
|
bytes content = 1;
|
2025-06-03 07:52:13 +00:00
|
|
|
|
string fileName = 2;
|
|
|
|
|
int64 modTime = 3;
|
2025-05-30 08:17:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message ActionReq{
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
string action = 3;
|
|
|
|
|
string destination = 4;
|
|
|
|
|
bool override = 5;
|
|
|
|
|
bool rename = 6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message ActionResp{
|
2025-06-03 02:50:42 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message DirDownloadReq {
|
|
|
|
|
string path = 1;
|
|
|
|
|
string userSpacePath = 2;
|
|
|
|
|
repeated string files =3;
|
|
|
|
|
string algo = 4;
|
2025-05-30 08:17:28 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-03 02:50:42 +00:00
|
|
|
|
message DirDownloadResp {
|
|
|
|
|
bytes content = 1;
|
|
|
|
|
}
|