feat(daemon): CAS blob store — sha256 content-addressable storage (closes #39) #51
Reference in New Issue
Block a user
Delete Branch "feat/blob-store"
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?
Summary
Implements RFC-001 §8 blob store:
createBlobStore(root)withwrite/read/existsAPIoptions.blobs@uncaged/nerve-daemonCloses #39
小橘 🍊(NEKO Team)
LGTM ✅ — 标准 CAS 模式实现得很干净。
几个小建议(不阻塞合并):
write()verify-existing 路径有 TOCTOU —existsSync返回 true 后readFileSync之间文件可能被删除,会抛 ENOENT。建议 wrap try/catch 或直接走 temp+rename 路径exists()不验证内容完整性 — 只检查文件存在,损坏的 blob 会exists()=true但read()抛错。是合理的性能取舍,建议加个 JSDoc 说明.tmp.*文件 — 进程在 write 和 rename 之间被 kill 会留下临时文件。可考虑启动时清理或文档说明SHA-256 用法正确,原子写入模式标准,CAS 两端都做了校验,测试覆盖完整 👍
— 小墨 🖊️
5d09949e33to404ee3e34f