Binary record format
Define a 28-byte header with magic bytes, version, record type, reserved bytes, key length, value length, timestamp, checksum, and payload offsets.
Build a small local database from byte layout up: binary records, append-only segment files, direct indexed reads, corruption checks, recovery, tombstones, compaction, Buffer ownership measurements, and benchmark reports.
$ npm run db -- --helpChecks the command router before storage exists.
$ npm run put -- name ishAppends a binary record to the segment file.
$ npm run get -- nameUses the latest offset from the in-memory index.
$ npm run recoverTruncates broken tails after a simulated crash.
$ npm run benchCompares replay, persisted index, and compaction cost.
Define a 28-byte header with magic bytes, version, record type, reserved bytes, key length, value length, timestamp, checksum, and payload offsets.
Build a CLI that encodes records, appends them to a segment file, tracks byte offsets, scans records sequentially, and inspects one record by offset.
Replay the segment into an in-memory index, persist the index, validate segment size, detect corruption, and truncate a partial tail to the last valid record.
Represent deletes as tombstones, compact live records into a replacement segment, measure Buffer ownership modes, and write benchmark reports.
The build starts with a command shell and ends with benchmark reports. Each phase adds one storage capability and one artifact a developer can inspect.
A project shell with package metadata, folders, command routing, help output, npm scripts, and strict placeholder behavior.
A documented binary disk contract with one source of truth for header offsets, widths, type values, and payload rules.
An encoder that produces inspectable record bytes and tests that protect the format before disk writes enter the project.
A decoder that validates fixed headers, calculates payload boundaries, supports payload ownership modes, and round-trips encoded records.
A segment file that grows by encoded record length and CLI output that exposes the address of every appended record.
A scanner that treats the segment as the durable record of writes and an inspect path for direct offset reads.
Checksum-valid records, repeatable corruption detection, offset-aware scan failures, and a clean segment for the next phase.
An index derived from the append-only log, plus direct lookup behavior that reads the latest record by byte address.
A validated persisted index cache and a report that shows whether lookup used persisted-index or full-replay mode.
An explicit recovery command that preserves the valid prefix, removes a broken tail, rebuilds indexes, and leaves an audit report.
Deletes represented as durable tombstones, lookup output that separates deleted from missing, and historical scan output.
A smaller live segment, a fresh index with new offsets, deterministic startup cleanup, and a compaction report.
A memory report that compares copy, slice, and subarray behavior during retained and non-retained scans.
Benchmark reports that measure disk size, memory, throughput, recovery cost, and compaction cost from a clean generated dataset.
Lab 02 treats generated files as part of the learning surface: format notes, segment inspection, index-load timing, recovery evidence, compaction deltas, Buffer ownership measurements, and benchmark summaries.
docs/format.mdrecord layout, byte order, and payload rulessegment-0001.datappend-only binary recordsdata/index.jsonlatest key-to-offset entriesindex-load.jsonpersisted-index versus replay timingrecovery.jsonvalid prefix, broken tail, and lost bytescompaction.jsonbefore/after size and dropped recordsbuffer-ownership.jsoncopy, slice, and subarray memory databench.mdthroughput, size, memory, and recovery resultsBuy a single volume or lock in every volume at once. Switch between one-reader pricing and team licenses for up to 25 members.
Volume I as EPUB, light and dark PDFs, slides, cheatsheets, and future updates.
Volume I Labs plus its downloadable bundle in one purchase. Save $9.99 vs buying the Digital Bundle and Labs separately.
Volume I long-form builds with checkpoints, hints, debugging notes, and expected output.
The bundle includes seven runtime projects covering process observation, binary storage, streams, module resolution, file watching, async orchestration, and custom protocols.
Lab 02 is included in the Labs bundle and in NodeBook Pro, alongside six more complete runtime projects.