Architecture
A small Swift package with no third-party dependency. The engine has no user-interface code, so the app, the command line and the Finder extension all use the same core.
Modules
| Module | Role |
|---|---|
ColdpackCore | Policy, watcher, scanner, state store, format learner, the writer for the compressed format, journal, recovery and the engine. |
coldpack | The command-line tool. |
ColdpackApp | The menu-bar app, written in SwiftUI. |
ColdpackFinder | The Finder extension. The bundle script packages it as an app extension. |
Coldpack uses only system frameworks and libraries.
Layers of the core
- Selection: watcher, scanner, path policy, eligibility, known formats, the format learner, churn backoff, open-file probe.
- Ports: small interfaces for what depends on the machine: the scope, open files, power state, the waste catalog. A bundle of ports has a standard and a sandboxed form. Tests inject fakes, so they never read the real machine.
- State: a SQLite database through the system library.
- Mutation: compress, decompress, restore and recovery, the writer, the journal.
- Orchestration: the engine, on one serial background queue. File events are stored on a separate queue so a long walk never delays them.
The compressed format
Coldpack writes the format that APFS already understands: a small attribute with a header (magic, type and size), and either the data inline or a resource fork of blocks of 64 KiB, compressed with LZFSE. It sets the compressed flag and releases the plain data. The kernel then expands the data when anything reads the file.
Tests
The suite has more than 350 tests that run against the real file system. Crash tests stop the process at every step of compression and decompression, and check that recovery restores the file. Other tests cover writes during an operation, hard links, links, empty and immutable files, partial clones, the dates, and Git's reaction to a changed change time. Each test names the bug it would catch. A set of render tests draws the app screens to images for review.
Releases
A release build is signed with a Developer ID from the inside out (the tool, the Finder extension, then the app), with the hardened runtime, notarized and stapled.