# NodeTaskService
> 节点同步任务相关服务

---

## countDoingNodeTasks
> 计算正在执行的任务数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeTaskService/countDoingNodeTasks`
- RPC：`rpc countDoingNodeTasks (CountDoingNodeTasksRequest) returns (RPCCountResponse);`

**请求对象 (`CountDoingNodeTasksRequest`)**

```json
{}
```

**响应对象 (`RPCCountResponse`)**

```json
{
  "count": "int64 // 数量"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeTaskService/countDoingNodeTasks" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## deleteAllNodeTasks
> 删除所有任务

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeTaskService/deleteAllNodeTasks`
- RPC：`rpc deleteAllNodeTasks(DeleteAllNodeTasksRequest) returns (RPCSuccess);`

**请求对象 (`DeleteAllNodeTasksRequest`)**

```json
{}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeTaskService/deleteAllNodeTasks" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## deleteNodeTask
> 删除任务

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeTaskService/deleteNodeTask`
- RPC：`rpc deleteNodeTask (DeleteNodeTaskRequest) returns (RPCSuccess);`

**请求对象 (`DeleteNodeTaskRequest`)**

```json
{
  "nodeTaskId": "int64"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeTaskService/deleteNodeTask" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## deleteNodeTasks
> 批量删除任务

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeTaskService/deleteNodeTasks`
- RPC：`rpc deleteNodeTasks (DeleteNodeTasksRequest) returns (RPCSuccess);`

**请求对象 (`DeleteNodeTasksRequest`)**

```json
{
  "nodeTaskIds": "[]int64"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeTaskService/deleteNodeTasks" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## existsNodeTasks
> 检查是否有正在执行的任务

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeTaskService/existsNodeTasks`
- RPC：`rpc existsNodeTasks (ExistsNodeTasksRequest) returns (ExistsNodeTasksResponse);`

**请求对象 (`ExistsNodeTasksRequest`)**

```json
{
  "excludeTypes": "[]string"
}
```

**响应对象 (`ExistsNodeTasksResponse`)**

```json
{
  "existTasks": "bool",
  "existError": "bool"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeTaskService/existsNodeTasks" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findNodeClusterTasks
> 获取所有正在同步的集群信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeTaskService/findNodeClusterTasks`
- RPC：`rpc findNodeClusterTasks (FindNodeClusterTasksRequest) returns (FindNodeClusterTasksResponse);`

**请求对象 (`FindNodeClusterTasksRequest`)**

```json
{}
```

**响应对象 (`FindNodeClusterTasksResponse`)**

```json
{
  "clusterTasks": "[]ClusterTask"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeTaskService/findNodeClusterTasks" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findNotifyingNodeTasks
> 查找需要通知的任务

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeTaskService/findNotifyingNodeTasks`
- RPC：`rpc findNotifyingNodeTasks (FindNotifyingNodeTasksRequest) returns (FindNotifyingNodeTasksResponse);`

**请求对象 (`FindNotifyingNodeTasksRequest`)**

```json
{
  "size": "int64 // 数量，通常不能小于0"
}
```

**响应对象 (`FindNotifyingNodeTasksResponse`)**

```json
{
  "nodeTasks": "[]NodeTask"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeTaskService/findNotifyingNodeTasks" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## updateNodeTasksNotified
> 设置任务已通知

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeTaskService/updateNodeTasksNotified`
- RPC：`rpc updateNodeTasksNotified (UpdateNodeTasksNotifiedRequest) returns (RPCSuccess);`

**请求对象 (`UpdateNodeTasksNotifiedRequest`)**

```json
{
  "nodeTaskIds": "[]int64"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeTaskService/updateNodeTasksNotified" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---
