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-sign-- the signing engines: dummy, ed25519, spki, and the GPG signer through thegpgbinary. Portable, with no repository knowledge.ostrya-fetch-- the async HTTP/1.1 and HTTP/2 fetcher, with TLS overrustls. Portable, with no repository knowledge.ostrya-remote-- the wire protocol and the client sessions of the push and of the pull: the messages and their GVariant encoding, the frame codec, the chunked object stream, the bodies of the pull, the push client session,StreamSession, the framed session of a pull over ssh or over a pair of byte streams, andPullSession, the session of a pull over the HTTP fetcher or over a stream session. It also holds the endpoint typesEndpoint,SshAddress, andSshOptions, and the ssh and HTTP transports. It holds the walk of a local directory into a tree model. It holds the tree push of that directory as one commit, signed when signers are given. The transports read no remote key and no file that a remote key names. Portable, with no repository knowledge. Depends onostrya-signandostrya-fetch.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, the resolution of a remote to an endpoint (ostrya::endpoint), and the paths listed under Status. Feature-gated.ostrya-cli-- the command-line front-end (builds theostryabinary).
Feature flags on ostrya:
smol(default) andtokio-- the runtime selectors.sign-spki-- the spki signature engine.verify-gpg-- GPG signature verification.sign-gpg-- GPG signing. It turns onverify-gpg.receive-- the server side of a push: the receive policy,Repo::receive, andRepo::receive_stream, which reads one one-way stream with no reply. Thereceivefeature ofostrya-cli, in its default set, buildsostrya receiveon it.push-- the client side of a push from a repository:Repo::push,Repo::push_over_stream,Repo::export_stream, which writes one one-way stream forRepo::receive_stream, andostrya::endpoint::resolve_push, which gives the endpoint of a configured remote or of an address. Thepushfeature ofostrya-cli, in its default set, buildsostrya pushandostrya push-treeon it.lzma-static-- the static xz build.
ostrya-remote is a dependency of ostrya in every build, re-exported as
ostrya::remote. Repo::send, the serving side of the pull over ssh, and
PullSession::over_stream with Repo::pull_with_session, its client side
over a pair of streams, take no feature. The send feature of ostrya-cli,
in its default set, builds ostrya send on Repo::send. Repo::pull runs
over ssh for an ssh address in PullOptions::overrides or in the remote key
pull-url, with no feature. ostrya::endpoint::resolve_pull reads the keys
and the files of a remote for a pull, with no feature.
Later phases add s3 and serve.
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.