docs(comments): 注释中文化 · internal/runtime/orchestration(29 文件,纯替换)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

- 只翻注释/文档字符串:剥离注释后代码行逐字节不变(机械校验只剩允许的行尾注释形态)
- 裁决编号与 design 节号(02.4.3 / 11.4.2 / design/05 §9 等)逐字保留
- 复核:go build 绿;orchestration 及其子包(audit/comm)测试绿;gofmt 干净
This commit is contained in:
AskaEth committed 2026-10-04 13:30:04 +08:00
1 parent fe90f64a56
commit eb1828ee7a
29 files changed
+751 -949

No files matched your search

@@ -8,22 +8,18 @@ import (
"git.yeij.top/AskaEth/Cyrene_v2/internal/bus"
)
// AskHandler processes an Ask addressed to this agent. It runs on the bus's
// per-subscription worker goroutine; for a single agent asks are serialized. A
// handler should answer via (p *Probe).Reply or Answer; a non-nil returned
// error is logged by the probe and discarded.
// AskHandler 处理发给本 agent 的 Ask。它运行在总线的按订阅工作 goroutine 上;对单个
// agent 而言 ask 是串行的。处理函数应经 (p *Probe).Reply 或 Answer 作答;返回的非 nil
// 错误由探针记日志并丢弃。
type AskHandler func(ctx context.Context, a Ask) error
// EventHandler processes an Event addressed to, or broadcast to, this agent.
// Because an agent subscribes to two event patterns (broadcast and addressed),
// the bus may invoke a handler concurrently from two worker goroutines, so an
// EventHandler must be safe for concurrent use.
// EventHandler 处理定向给本 agent 或广播给本 agent 的 Event。由于一个 agent 订阅了两个
// 事件模式(广播与定向),总线可能从两个工作 goroutine 并发调用同一个处理函数,因此
// EventHandler 必须可安全并发使用。
type EventHandler func(ctx context.Context, e Event) error
// SubscribeAsk registers h to receive every Ask addressed to this agent and
// returns an unsubscribe function that removes the registration. When ctx is
// canceled the registration is removed automatically; the returned function is
// idempotent.
// SubscribeAsk 登记 h 以接收发给本 agent 的每个 Ask,并返回一个解除登记的函数。ctx 被
// 取消时登记自动移除;返回的函数是幂等的。
func (p *Probe) SubscribeAsk(ctx context.Context, h AskHandler) (func(), error) {
if h == nil {
return nil, fmt.Errorf("comm: subscribe ask: handler must not be nil")
@@ -45,14 +41,11 @@ func (p *Probe) SubscribeAsk(ctx context.Context, h AskHandler) (func(), error)
return func() { unsub() }, nil
}
// SubscribeEvent registers h to receive both broadcast events and events
// addressed to this agent. It returns an unsubscribe function that removes both
// registrations; it is idempotent and safe to call more than once. When ctx is
// canceled both registrations are removed automatically.
// SubscribeEvent 登记 h 以同时接收广播事件与定向给本 agent 的事件。它返回一个移除两处
// 登记的函数;该函数幂等,多次调用也安全。ctx 被取消时两处登记都自动移除。
//
// The handler reaches the caller from two subscription worker goroutines and
// may also run concurrently with a SubscribeAsk handler, so it must be safe for
// concurrent use.
// 处理函数会从两个订阅工作 goroutine 抵达调用方,也可能与 SubscribeAsk 的处理函数并发
// 运行,因此它必须可安全并发使用。
func (p *Probe) SubscribeEvent(ctx context.Context, h EventHandler) (func(), error) {
if h == nil {
return nil, fmt.Errorf("comm: subscribe event: handler must not be nil")