docs: annotate Foundry source and deployment lifecycle in Chinese [skip ci]
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// 子画布所有权关系读写,统一循环/深度约束与 AI 子树失效处理,供移动、解散及撤销复用。
|
||||
package platform
|
||||
|
||||
import (
|
||||
@@ -6,22 +7,28 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// subgraphRelation 以 Child 唯一标识关系,Parent/Frame 定位其当前拥有者,Archived 控制活跃可见性。
|
||||
type subgraphRelation struct {
|
||||
Parent string `json:"parent_board_id"`
|
||||
Frame string `json:"frame_id"`
|
||||
Child string `json:"child_board_id"`
|
||||
Archived bool `json:"archived"`
|
||||
}
|
||||
|
||||
// subgraphRelationChange 保存前后关系;撤销前检查当前仍等于 After,再恢复 Before。
|
||||
type subgraphRelationChange struct {
|
||||
Before subgraphRelation `json:"before"`
|
||||
After subgraphRelation `json:"after"`
|
||||
}
|
||||
|
||||
// readSubgraphRelation 在调用方事务内锁住关系行,避免基于已变更父级编排事务。
|
||||
func readSubgraphRelation(r *http.Request, tx *sql.Tx, project, workspace, child string) (subgraphRelation, error) {
|
||||
result := subgraphRelation{Child: child}
|
||||
err := tx.QueryRowContext(r.Context(), `SELECT parent_board_id::text,frame_id,archived_at IS NOT NULL FROM canvas_subgraphs WHERE project=$1 AND workspace_id=$2 AND child_board_id=$3 FOR UPDATE`, project, workspace, child).Scan(&result.Parent, &result.Frame, &result.Archived)
|
||||
return result, err
|
||||
}
|
||||
|
||||
// writeSubgraphRelation 发生真实关系变更时检查新活跃位置并失效 AI 子树,再写父级/框及归档状态。
|
||||
func writeSubgraphRelation(r *http.Request, tx *sql.Tx, project, workspace string, relation subgraphRelation) error {
|
||||
before, err := readSubgraphRelation(r, tx, project, workspace, relation.Child)
|
||||
if err != nil {
|
||||
@@ -45,6 +52,7 @@ func writeSubgraphRelation(r *http.Request, tx *sql.Tx, project, workspace strin
|
||||
var errSubgraphCycle = errors.New("subgraph_cycle")
|
||||
var errSubgraphDepth = errors.New("subgraph_depth_exceeded")
|
||||
|
||||
// validateSubgraphPlacement 同查父方祖先与孩子后代;拒绝成环,合并后最大路径深度不得超过八。
|
||||
func validateSubgraphPlacement(r *http.Request, tx *sql.Tx, project, workspace, parent, child string) error {
|
||||
var cycle bool
|
||||
var depth int
|
||||
|
||||
Reference in New Issue
Block a user