Skip to content

Commit 39c6e28

Browse files
Refactor: Clean up code formatting and improve readability across multiple files
1 parent 9bd6d8a commit 39c6e28

45 files changed

Lines changed: 2119 additions & 2034 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 1750 additions & 1750 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/js_worker/script.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ async function handler(params, env, ctx) {}
4646
- `ctx`:运行时上下文,当前包含:
4747
- `ctx.runType`:当前入口名(`"onCall"` / `"onInlineCall"` / `"onCron"` / `"onRoute"`
4848
- `ctx.workerName`:当前 Worker 的名字
49-
- `ctx.inlineCall(js_worker_name, params, timeout_sec?)`:调用另一个 JS Worker 的 `onInlineCall`,返回其结果;会写入 `js_result`
49+
- `ctx.inlineCall(js_worker_name, params, timeout_sec?)`:调用另一个 JS Worker 的 `onInlineCall`,返回其结果;会写入
50+
`js_result`
5051
- `ctx.inlineCaller`:调用者脚本名(如 A 通过 `inlineCall` 调 B,则 B 中该值为 `"A"`;顶层调用为 `null`
5152

5253
`onRoute` 入口签名:
@@ -73,7 +74,7 @@ async function onRoute(request, env, ctx) {}
7374
- `nodeget(json)` — 传入完整 JSON-RPC 请求(string 或 object)
7475
- `nodeget(method, params)` — 快捷方式,自动生成 id
7576
- `nodeget(method, params, id)` — 快捷方式,指定 id
76-
返回解析后的 JS 对象。
77+
返回解析后的 JS 对象。
7778
- `globalThis.randomUUID()`:已注入,生成随机 UUID v4 字符串。
7879
- `ctx.inlineCall`:已注入,可 `await` 调用指定 `js_worker``onInlineCall`
7980
- 更多注入函数/对象见 [injected](./injected.md)

docs/api/kv/crud.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,11 @@
421421

422422
创建一个新的 Kv Namespace,该操作仅限 Super Token 使用。
423423

424-
创建 Namespace 的本质是在 KV 表中写入一条 key 为 `__nodeget_namespace_marker__`、value 为 `null` 的占位记录。Server 通过该记录判断 Namespace 是否存在。
424+
创建 Namespace 的本质是在 KV 表中写入一条 key 为 `__nodeget_namespace_marker__`、value 为 `null` 的占位记录。Server
425+
通过该记录判断 Namespace 是否存在。
425426

426-
该 key 是公开可见的:通过 `kv_get_all_keys``kv_get_value` 均可读取到。用户也可以通过 `kv_set_value` 修改其 value,或通过 `kv_delete_key` 删除它(删除后该 Namespace 将被视为不存在)。
427+
该 key 是公开可见的:通过 `kv_get_all_keys``kv_get_value` 均可读取到。用户也可以通过 `kv_set_value` 修改其 value,或通过
428+
`kv_delete_key` 删除它(删除后该 Namespace 将被视为不存在)。
427429

428430
### 方法
429431

docs/api/kv/special.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
### 所有 Namespace 通用
2323

24-
- `__nodeget_namespace_marker__`: Namespace 占位符。创建 Namespace(`kv_create`)时自动写入,value 为 `null`。Server 通过该 key 是否存在来判断 Namespace 是否已创建。该 key 公开可见,可通过 `kv_get_all_keys``kv_get_value` 读取,也可通过 `kv_set_value` 修改其 value。若通过 `kv_delete_key` 删除该 key 且 Namespace 下无其他 key,则该 Namespace 将被视为不存在。
24+
- `__nodeget_namespace_marker__`: Namespace 占位符。创建 Namespace(`kv_create`)时自动写入,value 为 `null`。Server 通过该
25+
key 是否存在来判断 Namespace 是否已创建。该 key 公开可见,可通过 `kv_get_all_keys``kv_get_value` 读取,也可通过
26+
`kv_set_value` 修改其 value。若通过 `kv_delete_key` 删除该 key 且 Namespace 下无其他 key,则该 Namespace 将被视为不存在。
2527

2628
### Agent Namespace
2729

docs/api/monitoring/agent.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ Agent 通过以下方法将采集的监控数据上报至 Server。关于上报
306306

307307
## Report Dynamic Summary
308308

309-
上报 Agent 的动态摘要监控数据。与 DynamicMonitoringData 不同,摘要数据将关键指标扁平化为独立列,所有字段(除 `uuid``time`)均为可选。
309+
上报 Agent 的动态摘要监控数据。与 DynamicMonitoringData 不同,摘要数据将关键指标扁平化为独立列,所有字段(除 `uuid`
310+
`time`)均为可选。
310311

311312
### 方法
312313

docs/api/monitoring/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,10 @@ JSON 示例:
372372

373373
- **StaticDataQueryField**: `cpu` / `system` / `gpu`
374374
- **DynamicDataQueryField**: `cpu` / `ram` / `load` / `system` / `disk` / `network` / `gpu`
375-
- **DynamicSummaryQueryField**: `cpu_usage` / `gpu_usage` / `used_swap` / `total_swap` / `used_memory` / `total_memory` /
376-
`available_memory` / `load_one` / `load_five` / `load_fifteen` / `uptime` / `boot_time` / `process_count` / `total_space` /
375+
- **DynamicSummaryQueryField**: `cpu_usage` / `gpu_usage` / `used_swap` / `total_swap` / `used_memory` /
376+
`total_memory` /
377+
`available_memory` / `load_one` / `load_five` / `load_fifteen` / `uptime` / `boot_time` / `process_count` /
378+
`total_space` /
377379
`available_space` / `read_speed` / `write_speed` / `tcp_connections` / `udp_connections` / `total_received` /
378380
`total_transmitted` / `transmit_speed` / `receive_speed`
379381

docs/api/monitoring/query.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,8 @@ pub struct DynamicSummaryAvgQuery {
11081108

11091109
## Dynamic Summary Multi Last Query
11101110

1111-
批量获取多个 Agent 的最新一条动态摘要监控数据。等价于为每个 UUID 执行 `agent_query_dynamic_summary` 并设置 `condition: ["last"]`
1111+
批量获取多个 Agent 的最新一条动态摘要监控数据。等价于为每个 UUID 执行 `agent_query_dynamic_summary` 并设置
1112+
`condition: ["last"]`
11121113

11131114
### 方法
11141115

docs/api/nodeget/crud.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,8 @@
517517

518518
- 语法与 `RUST_LOG` 环境变量相同,支持 `target=level` 的逗号分隔组合
519519
- 支持虚拟 target `db`,会自动展开为 `sea_orm` / `sea_orm_migration` / `sqlx`
520-
- 可用的 target: `server`, `rpc`, `db`, `kv`, `monitoring`, `task`, `token`, `js_worker`, `js_result`, `crontab`, `crontab_result`, `js_runtime`, `terminal`
520+
- 可用的 target: `server`, `rpc`, `db`, `kv`, `monitoring`, `task`, `token`, `js_worker`, `js_result`, `crontab`,
521+
`crontab_result`, `js_runtime`, `terminal`
521522
- 示例: `"info"` 接收所有 INFO 及以上级别,`"debug,db=trace"` 接收 DEBUG 级别 + 数据库 TRACE 级别
522523

523524
### 权限要求
@@ -533,7 +534,8 @@
533534

534535
### 返回值
535536

536-
订阅建立成功后,服务端通过 WebSocket 持续推送 JSON-RPC notification,每条 notification 的 `params.result` 为一个日志事件对象:
537+
订阅建立成功后,服务端通过 WebSocket 持续推送 JSON-RPC notification,每条 notification 的 `params.result`
538+
为一个日志事件对象:
537539

538540
- `timestamp`: ISO 8601 格式的时间戳(含时区)
539541
- `level`: 日志级别(`TRACE` / `DEBUG` / `INFO` / `WARN` / `ERROR`

docs/api/nodeget/index.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ NodeGet 是本项目的基础服务接口模块,提供服务端状态查询、
66

77
## 方法列表
88

9-
| 方法名 | 描述 | 权限要求 |
10-
|------------------------------------------------------|--------------------|-----------------------------|
11-
| [hello](./crud.md#hello) | 测试服务是否正常运行 ||
12-
| [version](./crud.md#version) | 获取服务端版本信息 ||
13-
| [uuid](./crud.md#uuid) | 获取当前 Server UUID ||
14-
| [list_all_agent_uuid](./crud.md#list-all-agent-uuid) | 获取所有 Agent UUID 列表 | `NodeGet::ListAllAgentUuid` |
15-
| [read_config](./crud.md#read-config) | 读取服务端配置文件原文 | SuperToken |
16-
| [edit_config](./crud.md#edit-config) | 写入并触发服务端配置热重载 | SuperToken |
17-
| [database_storage](./crud.md#database-storage) | 查询数据库各表存储占用 | SuperToken |
18-
| [log](./crud.md#log) | 查询内存日志缓冲区 | SuperToken |
9+
| 方法名 | 描述 | 权限要求 |
10+
|------------------------------------------------------|---------------------|-----------------------------|
11+
| [hello](./crud.md#hello) | 测试服务是否正常运行 ||
12+
| [version](./crud.md#version) | 获取服务端版本信息 ||
13+
| [uuid](./crud.md#uuid) | 获取当前 Server UUID ||
14+
| [list_all_agent_uuid](./crud.md#list-all-agent-uuid) | 获取所有 Agent UUID 列表 | `NodeGet::ListAllAgentUuid` |
15+
| [read_config](./crud.md#read-config) | 读取服务端配置文件原文 | SuperToken |
16+
| [edit_config](./crud.md#edit-config) | 写入并触发服务端配置热重载 | SuperToken |
17+
| [database_storage](./crud.md#database-storage) | 查询数据库各表存储占用 | SuperToken |
18+
| [log](./crud.md#log) | 查询内存日志缓冲区 | SuperToken |
1919
| [stream_log](./crud.md#stream-log) | 实时流式日志订阅(WebSocket) | SuperToken |
2020

2121
## 版本信息结构体

docs/api/task/crud.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@
148148

149149
## Create Task Blocking
150150

151-
`task_create_task_blocking``task_create_task` 的阻塞版本。创建任务后不立即返回 ID,而是等待 Agent 执行完毕并上传结果后,将完整的任务结果直接返回给调用者。
151+
`task_create_task_blocking``task_create_task` 的阻塞版本。创建任务后不立即返回 ID,而是等待 Agent
152+
执行完毕并上传结果后,将完整的任务结果直接返回给调用者。
152153

153154
### 方法
154155

0 commit comments

Comments
 (0)