libfasttree
A Rust library inspired by libostree, designed for managing immutable system images based on distribution repositories. It provides features like content-addressed storage (CAS), dependency resolution, delta updates, overlays, and more, with a focus on security, efficiency, and extensibility.
Features
- Supply Chain Security: Supports Sigstore/Cosign for keyless signing, FS-Verity for immutable files, and TPM integration for sealing keys based on system state.
- Storage Efficiency: Uses Zstandard compression with dictionaries, block-level deduplication via FastCDC, and a garbage collector for unused objects.
- System Management: Handles OverlayFS for ephemeral changes, Systemd-Sysext for dynamic extensions, and A/B partitioning for seamless updates.
- Plugin System: Extensible package managers via traits (e.g., APT, RPM, Nix, APK).
- Async I/O: Leverages Tokio and io_uring for high-performance operations on NVMe drives.
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Note: This library requires root privileges for some operations (e.g., mounting, chown). It depends on various crates like sqlx, tokio, nix, and others—see Cargo.toml for the full list.
Quick Start
Configuration
Create a Config struct to initialize the library:
use ;
use PathBuf;
use Tcti;
let config = Config ;
Initialization
use FastTree;
use Runtime;
async
Mini Tutorials
Tutorial 1: Installing a Package
Resolve dependencies, download, extract, store in CAS, build a tree, commit, and deploy:
async
This handles dependency resolution using a solver (mocked with libsolv), verifies signatures with Sigstore, compresses with Zstd, deduplicates blocks, and deploys with overlays.
Tutorial 2: Rolling Back
Rollback to the previous tree:
async
Tutorial 3: Garbage Collection
Clean up unused objects and chunks:
async
Tutorial 4: Building a System Extension (Sysext)
Create a sysext image from packages:
async
Load extensions via systemd-sysext merge.
Tutorial 5: Deploying a Reference
Deploy a committed tree:
async
This sets up overlays, updates the bootloader, and handles stateless configs.
Security Notes
- Use FS-Verity for immutable files: Files in CAS are protected at the filesystem level.
- TPM: Keys are sealed only if PCR values match expected system state.
- Signatures: Keyless with Sigstore for packages.
Contributing
Contributions welcome! See repository for issues and PRs.
License
MIT - See LICENSE for details.