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.
Create the storage engine shell with a runnable CLI, fixed folders, npm scripts, help output, strict command errors, and command placeholders.
Design the byte layout for one database record and document the file format beside the implementation constants.
Convert key/value data into one contiguous Buffer that matches the record format.
Parse a Buffer back into record data, validate malformed input, and prove encode/decode round trips.
Write encoded records to disk through append-only segment storage and report the byte address for each write.
Read records from disk in order without using an index, then inspect one record by byte offset.
Compute and verify CRC-32 checksums so corrupted record bytes are detected during reads.
Map keys to latest record offsets so get can seek directly to the newest value.
Save and reload the index from disk so startup can skip a full replay when the cached view matches the segment.
Detect records cut off mid-write and truncate the segment to the end of the last complete valid record.
Support deletion by appending DELETE records instead of rewriting existing records.
Rewrite live records into a smaller segment and drop overwritten records plus tombstones.
Compare copy-heavy and view-heavy parsing modes during large scans.
Benchmark puts, gets, scans, recovery, and compaction, then write machine-readable and readable reports.
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 resultsSwitch between one-reader pricing and team licenses for up to 25 team members.
Volume I as EPUB, light/dark PDFs, slides, cheatsheets, and future updates.
All Labs plus the downloadable Volume I bundle in one purchase. Save $9.99 vs buying separately.
Seven long-form builds: recorder, binary store, stream workbench, resolver, watcher, task runtime, and protocol gateway.
Volume I files, slides, cheatsheets, and updates for a small engineering team.
Node Runtime Labs plus the downloadable Volume I bundle in one team license.
Seven long-form builds for onboarding, study groups, and internal training.
The bundle includes seven runtime projects covering process observation, binary storage, streams, module resolution, file watching, async orchestration, and custom protocols.