mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-12-09 17:00:25 +08:00
增加ip2region库管理
This commit is contained in:
10
pkg/rpc/protos/model_file.proto
Normal file
10
pkg/rpc/protos/model_file.proto
Normal file
@@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message File {
|
||||
int64 id = 1;
|
||||
string filename = 2;
|
||||
int64 size = 3;
|
||||
}
|
||||
8
pkg/rpc/protos/model_file_chunk.proto
Normal file
8
pkg/rpc/protos/model_file_chunk.proto
Normal file
@@ -0,0 +1,8 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message FileChunk {
|
||||
bytes data = 1;
|
||||
}
|
||||
14
pkg/rpc/protos/model_ip_library.proto
Normal file
14
pkg/rpc/protos/model_ip_library.proto
Normal file
@@ -0,0 +1,14 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "model_file.proto";
|
||||
|
||||
message IPLibrary {
|
||||
int64 id = 1;
|
||||
string type = 2;
|
||||
int64 createdAt = 3;
|
||||
|
||||
File file = 30;
|
||||
}
|
||||
30
pkg/rpc/protos/service_file.proto
Normal file
30
pkg/rpc/protos/service_file.proto
Normal file
@@ -0,0 +1,30 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "rpc_messages.proto";
|
||||
|
||||
// 文件相关服务
|
||||
service FileService {
|
||||
// 创建文件
|
||||
rpc createFile (CreateFileRequest) returns (CreateFileResponse);
|
||||
|
||||
// 将文件置为已完成
|
||||
rpc updateFileFinished (UpdateFileFinishedRequest) returns (RPCUpdateSuccess);
|
||||
}
|
||||
|
||||
// 创建文件
|
||||
message CreateFileRequest {
|
||||
string filename = 1;
|
||||
int64 size = 2;
|
||||
}
|
||||
|
||||
message CreateFileResponse {
|
||||
int64 fileId = 1;
|
||||
}
|
||||
|
||||
// 将文件置为已完成
|
||||
message UpdateFileFinishedRequest {
|
||||
int64 fileId = 1;
|
||||
}
|
||||
46
pkg/rpc/protos/service_file_chunk.proto
Normal file
46
pkg/rpc/protos/service_file_chunk.proto
Normal file
@@ -0,0 +1,46 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "model_file_chunk.proto";
|
||||
|
||||
// 文件片段相关服务
|
||||
service FileChunkService {
|
||||
// 创建文件片段
|
||||
rpc createFileChunk (CreateFileChunkRequest) returns (CreateFileChunkResponse);
|
||||
|
||||
// 获取的一个文件的所有片段IDs
|
||||
rpc findAllFileChunkIds (FindAllFileChunkIdsRequest) returns (FindAllFileChunkIdsResponse);
|
||||
|
||||
// 下载文件片段
|
||||
rpc downloadFileChunk (DownloadFileChunkRequest) returns (DownloadFileChunkResponse);
|
||||
}
|
||||
|
||||
// 创建文件片段
|
||||
message CreateFileChunkRequest {
|
||||
int64 fileId = 1;
|
||||
bytes data = 2;
|
||||
}
|
||||
|
||||
message CreateFileChunkResponse {
|
||||
int64 fileChunkId = 1;
|
||||
}
|
||||
|
||||
// 获取的一个文件的所有片段IDs
|
||||
message FindAllFileChunkIdsRequest {
|
||||
int64 fileId = 1;
|
||||
}
|
||||
|
||||
message FindAllFileChunkIdsResponse {
|
||||
repeated int64 fileChunkIds = 1;
|
||||
}
|
||||
|
||||
// 下载文件片段
|
||||
message DownloadFileChunkRequest {
|
||||
int64 fileChunkId = 1;
|
||||
}
|
||||
|
||||
message DownloadFileChunkResponse {
|
||||
FileChunk fileChunk = 1;
|
||||
}
|
||||
67
pkg/rpc/protos/service_ip_library.proto
Normal file
67
pkg/rpc/protos/service_ip_library.proto
Normal file
@@ -0,0 +1,67 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "rpc_messages.proto";
|
||||
import "model_ip_library.proto";
|
||||
|
||||
// IP库
|
||||
service IPLibraryService {
|
||||
// 创建IP库
|
||||
rpc createIPLibrary (CreateIPLibraryRequest) returns (CreateIPLibraryResponse);
|
||||
|
||||
// 查找最新的IP库
|
||||
rpc findLatestIPLibraryWithType (FindLatestIPLibraryWithTypeRequest) returns (FindLatestIPLibraryWithTypeResponse);
|
||||
|
||||
// 查找单个IP库
|
||||
rpc findEnabledIPLibrary (FindEnabledIPLibraryRequest) returns (FindEnabledIPLibraryResponse);
|
||||
|
||||
// 列出某个类型的所有IP库
|
||||
rpc findAllEnabledIPLibrariesWithType (FindAllEnabledIPLibrariesWithTypeRequest) returns (FindAllEnabledIPLibrariesWithTypeResponse);
|
||||
|
||||
// 删除IP库
|
||||
rpc deleteIPLibrary (DeleteIPLibraryRequest) returns (RPCDeleteSuccess);
|
||||
}
|
||||
|
||||
// 创建IP库
|
||||
message CreateIPLibraryRequest {
|
||||
string type = 1;
|
||||
int64 fileId = 3;
|
||||
}
|
||||
|
||||
message CreateIPLibraryResponse {
|
||||
int64 ipLibraryId = 1;
|
||||
}
|
||||
|
||||
// 查找单个IP库
|
||||
message FindEnabledIPLibraryRequest {
|
||||
int64 ipLibraryId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledIPLibraryResponse {
|
||||
IPLibrary ipLibrary = 1;
|
||||
}
|
||||
|
||||
// 查找最新的IP库
|
||||
message FindLatestIPLibraryWithTypeRequest {
|
||||
string type = 1;
|
||||
}
|
||||
|
||||
message FindLatestIPLibraryWithTypeResponse {
|
||||
IPLibrary ipLibrary = 1;
|
||||
}
|
||||
|
||||
// 列出某个类型的所有IP库
|
||||
message FindAllEnabledIPLibrariesWithTypeRequest {
|
||||
string type = 1;
|
||||
}
|
||||
|
||||
message FindAllEnabledIPLibrariesWithTypeResponse {
|
||||
repeated IPLibrary ipLibraries = 1;
|
||||
}
|
||||
|
||||
// 删除IP库
|
||||
message DeleteIPLibraryRequest {
|
||||
int64 ipLibraryId = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user