DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

borui1757-cmd /

borui1757-cmd/dsh-guard

Verified

Danger-zone guard for DSH: single-instance check (two hosts on one profile lose 72% of writes), rolling snapshots, session integrity check, restore from the latest healthy snapshot.

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@205cc81a

dsh-guard

危险区守卫:动手前先备份,动完体检,坏了从快照补齐。

特性

  • 单实例检查:同 profile 起第二个宿主会互相覆盖写入——实测读-改-写丢 72%。guard_check 端口占用就劝住。
  • 滚动备份:guard_snapshot 默认保留最近 3 份,只清理自己造的 .bak-<iso>,不碰别人的文件。
  • 结构体检:guard_verify 检查会话能否解压、工具调用/结果是否配对完整,给出悬空调用位置。
  • 一键补齐:guard_restore 体检不合格时从最近一个合格快照恢复;恢复前把当前状态再备份一份,避免越救越糟。
  • 按魔数识别 zstd:不看扩展名。快照名形如 x.zstd.bak-<ts>,按扩展名判断会把快照当纯文本读,误报“所有快照都不合格”。
  • 只读优先:检查与体检不改文件;只有 restore 会写,且必然先备份。

四个工具

guard_check(port=3080)      → { busy, advice }
guard_snapshot(file, keep)  → 备份(滚动)
guard_verify(file)          → 解压 + 配对完整性
guard_restore(file)         → 体检不合格时补齐

为什么是“守卫”而不是“测试”

并发这类问题,测出来也只能证明“会坏”——宿主代码不归插件改。

能修的是拦住它:别让第二个实例起来。

测试:证明会坏(改不了)
守卫:不让它坏(能改)

数据

模式 实验 结果
追加写 8 进程 × 200 行 1600 行,0 交错 ✅
读-改-写 2 进程 × 50 次 实际 28,丢 72% ❌

会话存储是整文件 zstd 重写 = 读-改-写,所以“两个宿主同开”会毁数据。

标签

dsh-plugin backup snapshot session-recovery integrity-check single-instance data-safety zstd nodejs

状态

0.1.0 —— 四个工具自测 7/7 通过。

—/ 5

No ratings yet

Verified DSH bundle

Commit 205cc81a83bc

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout