Ostrya
Ostrya [n. a botanical genus within the family Betulaceae, commonly known as ironwood tree] is a from-scratch, pure-Rust, async reimplementation of the ostree repository library (libostree). It reproduces ostree's on-disk format byte-for-byte while presenting an idiomatic Rust API designed for asynchronous use and for multiple concurrent transactions within a single process.
Status
Work in progress. The library is being built along a phased roadmap
(docs/port-plan.md), and the API is not yet stable. The following paths are
implemented and verified against golden fixtures produced by the ostree tool:
- GVariant codec and the typed object-model codec layer
- Core format primitives: checksums, varint, loose paths,
ostree.sizespacking, xattr canonicalization, keyfile parsing - Object model: commit, dirtree, dirmeta, and file headers (bare, bare-user, bare-user-shared, archive; read-only support for bare-split-xattrs)
- Repository open, create, and config parsing
- Reading path: object, commit, and file-content loading, ref resolution and listing, tree traversal
- Runtime backend abstraction and the streaming hashing primitives
- Transactions and the two-layer repository lock
- Write path: object writers, in-memory tree assembly, filesystem ingest with a commit modifier, commit assembly and durable publication, overlay changeset import, and a path-addressed staging tree with tree merge
- Checkout path
- composefs/EROFS image writer and fs-verity digest (
ostrya-composefs)
In progress and planned: wiring composefs export into the library, tar
import/export, a minimal ostrya CLI, prune/fsck/diff, signing, summaries,
static deltas, pull, an ostree-compatible CLI for shell-test conformance,
and the S3 and SSH transport extensions. See docs/port-plan.md for the full
roadmap.
Design
- Pure Rust, with two C-linking exceptions:
liblzma, which the library links for xz in static deltas, and PCRE2, which theostrya-clibinary links for thecommit --tar-pathname-filterexpression. The library'slzma-staticfeature builds xz from source and links it statically; the feature is off by default, and a build without it links the system liblzma.ostrya-clicarries the feature in its default set, so the shippedostryabinary needs no runtime liblzma. Each static build requires no C runtime of its own beyond the libcstdalready links. PCRE2 belongs to that binary alone, which setspublish = false.rustixprovides the syscalls a portable async file API cannot express (fd-relative opens and metadata, xattrs, statx, FICLONE reflink,O_TMPFILE+ linkat, OFD-compatible record locks). Streaming file I/O goes through the runtime's async file. - Async throughout. The runtime backend sits behind the internal
ostrya-rtcrate:smolby default,tokiounder thetokiofeature. - Multiple concurrent transactions within a single process. A
Transactionis an owned handle carrying its own staging directory and counters;Repoholds only shared state and is cheaply clonable.Repo,Transaction,FileObject, and the content readers and writers areSend + Sync. - Byte-exact on-disk format. Field layouts, byte orders, sort orders, and
checksum algorithms match ostree exactly, verified in both directions: the
ostreetool reads what the library writes, and the library reads what the tool writes. - File content is streamed in bounded-size chunks end to end. Hashing, compression, object-store writes, checkout, and transfer never buffer an unconstrained blob in memory. Whole-buffer handling is reserved for metadata objects, whose size the format caps.
#![forbid(unsafe_code)]everywhere except two audited sites documented inCLAUDE.md.
Workspace layout
The project is a Cargo workspace of focused crates:
ostrya-gvariant-- byte-exact GVariant codec for the fixed type set ostree uses. No ostree knowledge.ostrya-core-- object model, checksums, varint, loose paths, xattr canonicalization, and format serialization. Depends onostrya-gvariant.ostrya-rt-- internal async-runtime abstraction (smolortokiobackend). The only crate that knows which backend is compiled.ostrya-composefs-- standalone, synchronous EROFS/composefs image writer and fs-verity digest. Takes a tree model and emits image bytes.ostrya-- the library: repo, transactions, commit, checkout, refs, reading, and the paths listed under Status. Feature-gated.ostrya-cli-- the command-line front-end (builds theostryabinary).
Feature flags on ostrya: the runtime selectors smol (default) and tokio,
and lzma-static for the static xz build; later phases add pull,
verify-gpg, sign-gpg (which turns on verify-gpg), deltas, s3, and
ssh.
Clean-room provenance and licensing
Ostrya is a clean-room reimplementation. Its design is grounded only in the
public ostree documentation (https://ostreedev.github.io/ostree/) and the
observed behavior of the ostree tool run as a black box. The LGPL libostree
source is not consulted, so the resulting code can be distributed under the MIT
license. The on-disk format Ostrya reproduces is an interoperability interface;
every format fact recorded in docs/format-reference.md is verifiable by
running the tool and inspecting the bytes it writes.
Building and testing
The workspace builds on stable Rust (edition 2024, minimum 1.92).
A Nix flake builds the ostrya binary and supplies the development
shell:
# other binaries the test suite runs
The flake exposes the package as an overlay under overlays.default, so
another flake can take pkgs.ostrya.
The test suite runs under both runtime backends:
The checked-in golden fixtures under tests/fixtures/ are outside every
crate root, so a crate published to crates.io carries none of them.
Consuming the fixtures from a git checkout needs no ostree tool.
Generating or regenerating them with tests/fixtures/generate.sh needs the
tool. See docs/port-plan.md, "Golden fixtures: layout, packaging, and how
to run them", for the fixture layout and the generator's requirements. The
section also gives the exact test commands. It explains how to tell a
skipped fixture test from a passing one.
Documentation
The design documents in docs/ are the source of truth and are kept in sync
with the code:
docs/format-reference.md-- the byte-exact on-disk formatdocs/port-plan.md-- architecture, testing strategy, and the phased roadmapdocs/api-sketch.md-- the target Rust-native async API
License
MIT.