docs: add agent auto-register & column validation rules
This commit is contained in:
@@ -161,18 +161,27 @@ col2
|
|||||||
- 写操作(`add`, `delete`, `set`)必须使用文件锁,防止多 Agent 并发写入导致数据损坏
|
- 写操作(`add`, `delete`, `set`)必须使用文件锁,防止多 Agent 并发写入导致数据损坏
|
||||||
- 读操作(`get`, `show`, `list columns`)无需锁
|
- 读操作(`get`, `show`, `list columns`)无需锁
|
||||||
|
|
||||||
### 2.9 错误退出码
|
### 2.9 Agent 自动注册
|
||||||
|
- **读/写操作时**:如果当前 `agent-id` 不存在于 `agent-scope` 中,自动创建空条目:
|
||||||
|
```json
|
||||||
|
"agent-scope": {
|
||||||
|
"new-agent-id": {}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- **字段验证**:如果 `column-name` 不存在于 `columns` 或 `public-columns` 中,返回错误(退出码 2)
|
||||||
|
|
||||||
|
### 2.10 错误退出码
|
||||||
| 退出码 | 含义 |
|
| 退出码 | 含义 |
|
||||||
|--------|------|
|
|--------|------|
|
||||||
| 0 | 成功 |
|
| 0 | 成功 |
|
||||||
| 1 | 参数错误 / 用法错误 |
|
| 1 | 参数错误 / 用法错误 |
|
||||||
| 2 | 字段不存在 |
|
| 2 | 字段不存在(column-name 不在 columns 或 public-columns 中) |
|
||||||
| 3 | 字段已存在 |
|
| 3 | 字段已存在 |
|
||||||
| 4 | 权限错误(非 pcexec 环境 / Agent 越权) |
|
| 4 | 权限错误(非 pcexec 环境 / Agent 越权) |
|
||||||
| 5 | 文件锁获取失败 |
|
| 5 | 文件锁获取失败 |
|
||||||
| 6 | JSON 解析/写入错误 |
|
| 6 | JSON 解析/写入错误 |
|
||||||
|
|
||||||
### 2.10 值的大小限制
|
### 2.11 值的大小限制
|
||||||
- 单字段值长度无限制
|
- 单字段值长度无限制
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user