Module: Bitfab::DbSnapshot

Defined in:
lib/bitfab/db_snapshot.rb

Overview

Per-trace database snapshot ref capture.

Every root trace carries a snapshot ref that pins the DB state at trace open by wall-clock timestamp. Capturing the timestamp is free (no IO) and harmless, so it happens on every trace regardless of configuration: that lets any trace be replayed against a historical branch later. The provider is resolved at replay time. Mirrors the TypeScript and Python SDKs’ DbSnapshotRef wire shape (camelCase key, since the server speaks the same protocol for every SDK).

Class Method Summary collapse

Class Method Details

.build_snapshot_ref(sdk_wall_clock_before_fn) ⇒ Hash

Build a snapshot ref for one trace. Synchronous, no IO.

Stores only the wall clock the SDK observed immediately before invoking the wrapped function; the server-side resolver uses that as the snapshot timestamp. No provider is captured (it is resolved at replay time).

Parameters:

  • sdk_wall_clock_before_fn (String)

    ISO wall-clock timestamp the SDK observed immediately before invoking the wrapped function.

Returns:

  • (Hash)

    snapshot ref with a single camelCase sdkWallClockBeforeFn key.



25
26
27
# File 'lib/bitfab/db_snapshot.rb', line 25

def build_snapshot_ref(sdk_wall_clock_before_fn)
  {"sdkWallClockBeforeFn" => sdk_wall_clock_before_fn}
end