package
Version:
v0.9.0
Opens a new window with list of versions in this module.
Published: Aug 19, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package snapbuf 提供固定深度的环形快照缓冲,用于延迟补偿/server rewind。
type Ring[S any] struct {
}
Ring 保存最近 depth 帧的快照(S 由业务定义,如 world 副本)。
New 创建深度为 depth 的环形缓冲(depth<=0 时取 64)。
Len 返回当前缓冲中的帧数(<= depth)。
Nearest 返回 <= frame 的最近快照(用于 RTT 补偿)。
Push 写入 frame 对应的快照;frame 应单调递增。
Source Files
¶
Click to show internal directories.
Click to hide internal directories.