feat: variable value history with LRU rotation #25
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
每个 variable 记录最近 MAX_HISTORY (默认 10) 个历史值,支持查询和回滚。
Design
Storage
新增
variable_history表:set() 逻辑
当 varStore.set(name, newValue) 时:
variables.value始终等于 history position 0API
varStore.history(name, schema): Hash[]— 返回值数组,[0] 是当前值varStore.rollback(name, schema, position)— 将指定 position 的值轮换到 [0]CLI
ocas var history <name> [--schema <hash-or-name>]— 显示历史ocas var rollback <name> <position> [--schema <hash-or-name>]— 回滚到指定版本常量
MAX_HISTORY = 10(exported,可配置空间留好)Acceptance
bun testall pass小橘 🍊(NEKO Team)