Documentation
¶
Overview ¶
Package pacer 流式增量节流器:LLM token 级分片若逐条发布会洪泛事件通道与 前端(每秒数次×千字级文本),按「距上次发布 ≥interval 或缓冲 ≥bytes」合并 发布;总量帽内单流 seq 自 1 单调递增;权威快照到达即 Absorb 收口(此后迟到 分片丢弃);收尾残尾用 Flush 落地。
单 goroutine 契约:与消费方事件回调同一约束面(回调在 drain 循环内同步执行, 不阻塞不并发),故不加锁;跨 goroutine 使用由调用方自行串行化。
Index ¶
Constants ¶
View Source
const ( // DefaultInterval 缺省时间窗。 DefaultInterval = 400 * time.Millisecond // DefaultBytes 缺省缓冲窗(字节口径:缓冲达到即提前发布;CJK 场景 // 200 字节 ≈ 66 汉字)。v0.12.0 改名 DefaultChars→DefaultBytes—— // 实现一直是 len(s.text) 字节比较,命名与口径对齐(第八轮审计)。 DefaultBytes = 200 // DefaultCapBytes 单流发布总量帽(深度思考可极长,超帽静默停发)。 DefaultCapBytes = 64 << 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream 单条流的增量缓冲与节拍判定。
func (*Stream) Buffered ¶
Buffered 当前滞留缓冲的字节数(观测面:超帽/收口后应恒 0——超帽静默停发 的感知锚点,消费方据此区分「流进行中」与「已被帽截断、等权威快照」)。
Click to show internal directories.
Click to hide internal directories.