class

TransFS::Log

Inherits Reference < Object

The append-only claim log for one document. This is the source of truth; the (future) SQLite index is a rebuildable fold of these. See §3.

Layout: <root>/.transfs/docs/<hh>/<hex-id>.log, where the id is the hex of the document's create-claim hash and <hh> is its first two hex chars — the same fan-out as the blob tree.

Durability (§3): the log is the write-ahead log; we don't journal it.

  • append writes the record then fsyncs before the caller acts on it;
  • a torn trailing line (crash mid-append) fails to parse and is skipped;
  • content blobs are always written before the claim that references them, so a crash leaves only harmless orphan blobs (GC sweeps them), never a dangling reference.

Constructors

new(root : String, id : String)
Source

Class methods

all_ids(root : String) : Array(String)

Every document id present in the store (by walking the docs tree).

Source
corruptions(root : String) : Array(Corrupt)
Source
docs_dir(root : String) : String
Source
read_all(root : String) : Array(Tuple(String, ReadResult | Corrupt))
Source
torn_tails(root : String) : Array(TornTail)
Source

Instance methods

append(*claims : Claim) : Nil

Append one or more claims and fsync before returning. The interim JSON-lines format can recover a torn final line, but true multi-record batch atomicity waits on a record-stream commit marker.

Source
claims

Read and parse every claim in order. A malformed final line is tolerated as a recoverable torn tail; malformed earlier lines are corruption.

Source
exists?
Source
path
Source
read
Source
scan

Every syntactically valid known claim in the log. Unlike #read, this reports malformed lines wherever they appear instead of applying recovery.

Source
scan
Source

Nested types