docs: annotate Foundry source and deployment lifecycle in Chinese [skip ci]
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// 旧快照操作协议 v1 的纯批处理器,canonical 模型协议 v2 使用另一套 before/after reducer。
|
||||
package platform
|
||||
|
||||
import (
|
||||
@@ -8,6 +9,7 @@ import (
|
||||
|
||||
const canvasOperationsProtocol = 1
|
||||
|
||||
// canvasOperation 表示节点/边创建、patch 或删除,元素 ID 与完整 Record 内 ID 必须一致。
|
||||
type canvasOperation struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
@@ -16,6 +18,8 @@ type canvasOperation struct {
|
||||
Record json.RawMessage `json:"record,omitempty"`
|
||||
Patch map[string]json.RawMessage `json:"patch,omitempty"`
|
||||
}
|
||||
|
||||
// canvasOperationBatch 用请求键及参与画布版本表包裹有序操作,HTTP 编排负责授权和事务。
|
||||
type canvasOperationBatch struct {
|
||||
ProtocolVersion int `json:"protocol_version"`
|
||||
RequestID string `json:"request_id"`
|
||||
@@ -27,6 +31,7 @@ var errInvalidCanvasOperation = errors.New("invalid_canvas_operation")
|
||||
|
||||
// applyCanvasOperations stages a complete batch. Input snapshots are never mutated.
|
||||
// HTTP/auth/version/idempotency are checked by the transaction coordinator.
|
||||
// applyCanvasOperations 复制所有输入,执行完全部操作才统一 normalize 并各增一次版本,失败不返回部分结果。
|
||||
func applyCanvasOperations(initial map[string]canvasSnapshot, operations []canvasOperation) (map[string]canvasSnapshot, error) {
|
||||
if len(operations) == 0 || len(operations) > 2500 {
|
||||
return nil, errInvalidCanvasOperation
|
||||
@@ -96,6 +101,7 @@ func applyCanvasOperations(initial map[string]canvasSnapshot, operations []canva
|
||||
if !allowed {
|
||||
return nil, errInvalidCanvasOperation
|
||||
}
|
||||
// data 是逐键 merge(null 删除),几何等字段整体替换,避免位置 patch 覆盖其他已保存内容。
|
||||
if field == "data" {
|
||||
// Merge individual data fields; a geometry-only patch never rolls back titles/assets.
|
||||
var before, patch map[string]json.RawMessage
|
||||
|
||||
Reference in New Issue
Block a user