mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-12-15 21:36:35 +08:00
增加刷新、预热缓存任务管理
This commit is contained in:
22
pkg/rpc/protos/models/model_http_cache_task.proto
Normal file
22
pkg/rpc/protos/models/model_http_cache_task.proto
Normal file
@@ -0,0 +1,22 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "models/model_user.proto";
|
||||
import "models/model_http_cache_task_key.proto";
|
||||
|
||||
message HTTPCacheTask {
|
||||
int64 id = 1;
|
||||
int64 userId = 2;
|
||||
string type = 3;
|
||||
string keyType = 4;
|
||||
int64 createdAt = 5;
|
||||
int64 doneAt = 6;
|
||||
bool isDone = 7;
|
||||
bool isOk = 8;
|
||||
string description = 9;
|
||||
|
||||
User user = 30;
|
||||
repeated HTTPCacheTaskKey httpCacheTaskKeys = 31;
|
||||
}
|
||||
15
pkg/rpc/protos/models/model_http_cache_task_key.proto
Normal file
15
pkg/rpc/protos/models/model_http_cache_task_key.proto
Normal file
@@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message HTTPCacheTaskKey {
|
||||
int64 id = 1;
|
||||
int64 taskId = 2;
|
||||
string key = 3;
|
||||
string type = 4;
|
||||
string keyType = 5;
|
||||
bool isDone = 6;
|
||||
bytes errorsJSON = 7;
|
||||
int64 nodeClusterId = 8;
|
||||
}
|
||||
82
pkg/rpc/protos/service_http_cache_task.proto
Normal file
82
pkg/rpc/protos/service_http_cache_task.proto
Normal file
@@ -0,0 +1,82 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "models/rpc_messages.proto";
|
||||
import "models/model_http_cache_task.proto";
|
||||
|
||||
// 缓存任务管理
|
||||
service HTTPCacheTaskService {
|
||||
// 创建任务
|
||||
rpc createHTTPCacheTask(CreateHTTPCacheTaskRequest) returns (CreateHTTPCacheTaskResponse);
|
||||
|
||||
// 计算任务总数量
|
||||
rpc countHTTPCacheTasks(CountHTTPCacheTasksRequest) returns (RPCCountResponse);
|
||||
|
||||
// 计算正在执行的任务数量
|
||||
rpc countDoingHTTPCacheTasks(CountDoingHTTPCacheTasksRequest) returns (RPCCountResponse);
|
||||
|
||||
// 列出单页任务
|
||||
rpc listHTTPCacheTasks(ListHTTPCacheTasksRequest) returns (ListHTTPCacheTasksResponse);
|
||||
|
||||
// 查找单个任务
|
||||
rpc findEnabledHTTPCacheTask(FindEnabledHTTPCacheTaskRequest) returns (FindEnabledHTTPCacheTaskResponse);
|
||||
|
||||
// 删除任务
|
||||
rpc deleteHTTPCacheTask(DeleteHTTPCacheTaskRequest) returns (RPCSuccess);
|
||||
|
||||
// 重置任务状态
|
||||
rpc resetHTTPCacheTask(ResetHTTPCacheTaskRequest) returns (RPCSuccess);
|
||||
}
|
||||
|
||||
// 创建任务
|
||||
message CreateHTTPCacheTaskRequest {
|
||||
string type = 1;
|
||||
string keyType = 2;
|
||||
repeated string keys = 3;
|
||||
}
|
||||
|
||||
message CreateHTTPCacheTaskResponse {
|
||||
int64 httpCacheTaskId = 1;
|
||||
int64 countKeys = 2;
|
||||
}
|
||||
|
||||
// 计算任务总数量
|
||||
message CountHTTPCacheTasksRequest {
|
||||
|
||||
}
|
||||
|
||||
// 计算正在执行的任务数量
|
||||
message CountDoingHTTPCacheTasksRequest {
|
||||
|
||||
}
|
||||
|
||||
// 查找单个任务
|
||||
message FindEnabledHTTPCacheTaskRequest {
|
||||
int64 httpCacheTaskId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledHTTPCacheTaskResponse {
|
||||
HTTPCacheTask httpCacheTask = 1;
|
||||
}
|
||||
|
||||
// 列出单页任务
|
||||
message ListHTTPCacheTasksRequest {
|
||||
int64 offset = 1;
|
||||
int64 size = 2;
|
||||
}
|
||||
|
||||
message ListHTTPCacheTasksResponse {
|
||||
repeated HTTPCacheTask httpCacheTasks = 1;
|
||||
}
|
||||
|
||||
// 删除任务
|
||||
message DeleteHTTPCacheTaskRequest {
|
||||
int64 httpCacheTaskId = 1;
|
||||
}
|
||||
|
||||
// 重置任务状态
|
||||
message ResetHTTPCacheTaskRequest {
|
||||
int64 httpCacheTaskId = 1;
|
||||
}
|
||||
53
pkg/rpc/protos/service_http_cache_task_key.proto
Normal file
53
pkg/rpc/protos/service_http_cache_task_key.proto
Normal file
@@ -0,0 +1,53 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "models/model_http_cache_task_key.proto";
|
||||
import "models/rpc_messages.proto";
|
||||
|
||||
// 缓存任务Key管理
|
||||
service HTTPCacheTaskKeyService {
|
||||
// 校验缓存Key
|
||||
rpc validateHTTPCacheTaskKeys(ValidateHTTPCacheTaskKeysRequest) returns (ValidateHTTPCacheTaskKeysResponse);
|
||||
|
||||
// 查找需要执行的Key
|
||||
rpc findDoingHTTPCacheTaskKeys(FindDoingHTTPCacheTaskKeysRequest) returns (FindDoingHTTPCacheTaskKeysResponse);
|
||||
|
||||
// 更新一组Key状态
|
||||
rpc updateHTTPCacheTaskKeysStatus(UpdateHTTPCacheTaskKeysStatusRequest) returns (RPCSuccess);
|
||||
}
|
||||
|
||||
// 校验缓存Key
|
||||
message ValidateHTTPCacheTaskKeysRequest {
|
||||
repeated string keys = 1;
|
||||
}
|
||||
|
||||
message ValidateHTTPCacheTaskKeysResponse {
|
||||
repeated FailKey failKeys = 1;
|
||||
|
||||
message FailKey {
|
||||
string key = 1;
|
||||
string reasonCode = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// 查找需要执行的Key
|
||||
message FindDoingHTTPCacheTaskKeysRequest{
|
||||
int64 size = 1;
|
||||
}
|
||||
|
||||
message FindDoingHTTPCacheTaskKeysResponse {
|
||||
repeated HTTPCacheTaskKey httpCacheTaskKeys = 1;
|
||||
}
|
||||
|
||||
// 更新一组Key状态
|
||||
message UpdateHTTPCacheTaskKeysStatusRequest {
|
||||
repeated KeyResult keyResults = 1;
|
||||
|
||||
message KeyResult {
|
||||
int64 id = 1;
|
||||
int64 nodeClusterId = 2; // 特意设置的冗余数据
|
||||
string error = 3;
|
||||
}
|
||||
}
|
||||
@@ -530,9 +530,9 @@ message FindNearbyServersResponse {
|
||||
|
||||
// 清除缓存
|
||||
message PurgeServerCacheRequest {
|
||||
repeated string domains = 1;
|
||||
repeated string keys = 2;
|
||||
repeated string prefixes = 3;
|
||||
string description = 4; // 任务描述
|
||||
}
|
||||
|
||||
message PurgeServerCacheResponse {
|
||||
|
||||
Reference in New Issue
Block a user