Why: C4 and C5 need a shared way to start, refuse, and tear down stacks without touching production ports or processes. Evidence: tests/ops/self_check.sh passed (help, unknown arg, foreign name, production port, busy port, SIGINT cleanup). drill_driver go test passed. Impact: New tests/ops library and HTTP driver. No drill result and no release-gate change yet. Refs: docs/release-multi-instance.md C4 C5 Co-authored-by: Cursor <cursoragent@cursor.com>
27 lines
449 B
Go
27 lines
449 B
Go
package main
|
|
|
|
// seqHoles 返回已观察到的 seq 里缺失的编号。空切片没有洞。
|
|
func seqHoles(seqs []int64) []int64 {
|
|
if len(seqs) == 0 {
|
|
return nil
|
|
}
|
|
min, max := seqs[0], seqs[0]
|
|
seen := map[int64]bool{}
|
|
for _, s := range seqs {
|
|
seen[s] = true
|
|
if s < min {
|
|
min = s
|
|
}
|
|
if s > max {
|
|
max = s
|
|
}
|
|
}
|
|
var holes []int64
|
|
for s := min; s <= max; s++ {
|
|
if !seen[s] {
|
|
holes = append(holes, s)
|
|
}
|
|
}
|
|
return holes
|
|
}
|