You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sequenceDiagram
participant N as 新节点
participant A as 任意成员
participant L as leader
N->>A: POST /api/v1/cluster/join {node_id, addrs}
A->>L: Raft 提案(写,经多数派)
L-->>A: 成员表(加为 learner)
A-->>N: 200 {members}
N->>L: 拉取快照 + 日志(限速)
N-->>L: 追平确认
admin->>L: POST /cluster/promote {node_id}
L-->>admin: 200 {members}(voter)
Note over N,L: 此后 N 参与投票与读写(I2 始终成立)
Loading
2.2 发布(I4/I5/I10)
sequenceDiagram
participant U as Admin UI
participant API as HTTP 管理面
participant L as leader(状态机)
participant W as watch 扇出
participant S as SDK 订阅者
U->>API: PUT .../branches/{b}/draft {updates}
API->>L: Raft 提案(草稿写入)
L-->>API: 200 {draft}
U->>API: POST .../publish {comment, request_id}
API->>L: Raft 提案(单次 apply:校验→物化→diff→版本→指针→清草稿→幂等记录)
alt 校验失败(policy=block)
L-->>API: 422 ERR_PUBLISH_BLOCKED {明细}
else 成功
L-->>API: 200 {version, changes}
L--)W: 提交后事件 {version, changes}
W--)S: WatchEvent(有序,版本递增)
Note over L: I5:以上全部在同一提案内,无半发布状态
end
Loading
2.3 watch 生命周期(I4,含断线续传与慢消费者)
sequenceDiagram
participant S as SDK
participant G as gRPC Watch
participant R as 重放器
S->>G: Watch{project, branch, after_version=0}
G-->>S: 当前版本号(SDK 再 GetConfig 拉全量)
G-->>S: 事件流(仅发布时产生,I4)
Note over S,G: 断线(60s 无数据)
S->>G: Watch{..., after_version=last}
alt 起点仍可重放
R-->>S: 重放 last 之后全部事件 → 转实时
else 起点已裁剪
G-->>S: ERR_VERSION_PRUNED
S->>G: GetConfig 重拉全量 → 重新订阅
end
Note over S,G: 慢消费者:缓冲溢出 → 服务端发 snapshot_required=true 并关流
Loading
2.4 SDK failover(R3)
sequenceDiagram
participant S as SDK
participant E1 as 端点1(非leader)
participant E2 as 端点2(leader)
S->>E1: GetConfig
E1-->>S: ERR_LEADER_REDIRECT {leader_hint: E2}
S->>E2: GetConfig(缓存 leader)
S->>E1: 写类请求仍尝试(若 E1 变 leader 则成功)
Note over S: 端点失败→指数退避(500ms→30s)+抖动;成员表定期刷新(ListMembers)
Loading
2.5 回滚(I6/I9)
sequenceDiagram
participant U as Admin UI
participant L as leader
participant S as SDK
U->>L: POST .../rollback {to_version, comment, request_id}
L->>L: 读 to_version 快照(checkpoint 重建) → 创建新版本 no+1(rollback_of)
L-->>U: 200 {new_version}
L--)S: WatchEvent{type=ROLLBACK, version=no+1}
Note over L: 历史版本不被修改(I6);审计含 rollback_of(I9)
Loading
2.6 共享库发布与级联(auto,D7/D15)
sequenceDiagram
participant U as Admin UI
participant L as leader
participant P1 as 引用项目A(分支prod)
participant S as SDK(项目A)
U->>L: POST /api/v1/shared/publish {comment, request_id}
L->>L: 校验+引用反查(idx/ref) → 受影响列表预览(发布前 UI 展示)
L->>L: 单提案内:共享版本 + 各受影响分支版本推进(原子,任一步失败整批回滚)
L-->>U: 200 {version, affected:[{project, branch, new_version}]}
L--)S: WatchEvent{type=SHARED_CASCADE, version=新}