Skip to main content

Crate btm

Crate btm 

Source
Expand description

§BTM

Blockchain Time Machine.

BTM is an incremental data backup mechanism that does not require downtime.

  • rollback to the state of a desired block height
  • hot backup during operation, no downtime is needed
  • based on OS-level infrastructure, stable and reliable
  • very small resource usage, almost no performance damage

§Platform support

Snapshot orchestration requires Linux (zfs/btrfs tooling). On other platforms the crate still compiles so that cross-platform callers can embed it unconditionally: BtmCfg::snapshot degrades to a no-op, while destructive/query operations (rollback, list, clean) fail at runtime instead of pretending to succeed.

§Index semantics for non-blockchain callers

idx is just a monotonically increasing u64 — block heights for blockchains, but any dense counter works (e.g. minutes since an epoch). Note that the itv alignment gate applies at snapshot creation time: with itv > 1, only indexes aligned to the interval (anchored at u64::MAX) produce a snapshot, so sparse counters like raw unix timestamps should use itv = 1 and control cadence at the call site.

§Rollback semantics

Rollback is destructive: the zfs driver uses zfs rollback -r, which destroys every snapshot newer than the rollback target. To inspect a snapshot without destroying history, clone it manually instead (zfs clone <volume>@<idx> <target>).

Structs§

BtmCfg
Configures of snapshot mgmt

Enums§

SnapAlgo
Snapshot management algorithm
SnapMode
Inner Operations

Constants§

CAP_MAX
Maximum number of snapshots that can be kept
STEP_CNT
itv.pow(i), only useful within the SnapAlgo::Fade algo

Functions§

run_daemon
Run btm daemon ... server