Expand description
An async, pure-Rust library that reads and writes ostree repositories.
A user opens a repository, writes commits in transactions, reads and checks
out trees, and pulls, pushes, signs, and prunes. The bytes on disk are the
bytes that the ostree command writes. Many Transactions can write to
one repository at once in one process.
As an extension, the crate also has a push protocol over HTTP and over ssh.
With the push feature, Repo::push sends commits to a remote. With the
receive feature, the receive module takes a push on the server side.
§Entry points
Repo::openandRepo::creategive aRepo, the handle of a repository.Repo::transactionbegins aTransaction, which publishes objects and refs at commit.StagingTreeandMutableTreebuild the tree of a new commit.Repo::checkout_atwrites the tree of a commit into a directory.Repo::pullcopies commits from a remote, andRepo::pull_localfrom a local repository.Repo::pull_with_sessioncopies commits from a remote through a session of the caller.Erroris the error of each fallible operation of the crate.
§Modules
- Read:
read,file,tree,refs, andtraverse. - Write:
transaction,mtree,staging_tree,commit,modifier,bootable. - Checkout and export:
checkout,composefs,tar, andarchive. - Pull:
pull,summary,fetch, the HTTP client ofostrya-fetch, andremote, which holds the session of a pull over HTTP, over ssh, or over a pair of byte streams. - Push and receive:
remote, the wire protocol ofostrya-remote, andreceive. - Remote resolution:
endpoint, which reads the keys and files of a remote for a pull or a push. - Signing:
sign,gpg, andspki. - Signature trust:
verify, the trusted keys and the trust of one pull. - Maintenance:
prune,fsck,diff,update, andconfig. - Static deltas:
DeltaSuperblock,DeltaOptions,AdvertisedDelta, andRepo::generate_static_delta.
§Features
smol(default): thesmolbackend ofostrya-rt.tokio: thetokiobackend ofostrya-rt.sign-spki: thespkimodule, the spki signing engine.verify-gpg: thegpgmodule, GPG verification and keyring management.sign-gpg:GpgSigner, which signs with thegpgcommand. It turns onverify-gpg.receive: thereceivemodule, the receive side of a push.push:Repo::pushandRepo::export_stream, the push from a repository.lzma-static: xz built from source and linked statically, with no runtime liblzma.
§Examples
let repo = ostrya::Repo::open("/srv/repo".as_ref()).await?;
let tip = repo.resolve_rev("exampleos/stable", false).await?;Re-exports§
pub use ostrya_fetch as fetch;pub use ostrya_remote as remote;
Modules§
- archive
- The archive view of a repository.
- base64
- Standard base64 (RFC 4648) for byte strings of any length.
- bootable
- The kernel version of a bootable commit, and the metadata pair that holds it.
- checkout
- The checkout of a committed tree into a directory on the file system.
- commit
- Commit objects and the detached metadata of a commit.
- composefs
- Export of a commit as a composefs EROFS image.
- config
- The typed view of the repository
configfile. - diff
- The comparison of two trees.
- endpoint
- The resolution of a remote to an
Endpoint. - error
- The error type of this crate.
- file
- Read access to file objects: their metadata and their payload.
- fsck
- Checks of the integrity and the completeness of a repository.
- gpg
verify-gpg - GPG (OpenPGP) signature verification, keyring management, and signing.
- modifier
- The commit modifier: the options that shape the ingest of a directory.
- mtree
- Directory trees built in memory and written as dirtree objects.
- prune
- Removal of unreachable objects.
- pull
- Pulls of refs and their objects from another repository.
- read
- Reads of metadata objects and of the state of a commit.
- receive
receive - The receive side of a push: the policy and the sessions of a server.
- refs
- Ref resolution, listing, and writes.
- repo
- The repository handle and the options of a new repository.
- sign
- Commit signatures, the signing engines, and the key store.
- spki
sign-spki - The spki signing engine: ECDSA signatures on P-256 with SPKI public keys.
- staging_
tree - Construction of a tree by path inside a transaction.
- summary
- The summary of a repository: the
summaryfile and its signatures. - tar
- Tar import and export.
- transaction
- Transactions: the write path of a repository.
- traverse
- Walks of the objects that commits reach, and listings of loose objects.
- tree
- The read-only walk of the file tree of a commit.
- update
- The update guard: an exclusive hold on the writes of refs and
config. - verify
- The trusted keys and the trust of one pull.
Structs§
- Checksum
- A 32-byte SHA-256 checksum that names an object.
- Commit
- An owned commit object.
- Delta
Fallback - An object that a static delta delivers as a loose object, outside its parts.
- Delta
OpCounts - The number of operations of each opcode in the operation stream of a part.
- Delta
Options - The options of
Repo::generate_static_delta. - Delta
Part - The meta-entry of one part of a static delta.
- Delta
Part Stats - The table sizes, the blob size, and the operation counts of one part.
- Delta
Superblock - A parsed static-delta superblock.
- Dict
Builder - A builder for an
a{sv}dict value. - DirMeta
- An owned dirmeta object: the owner, the mode, and the xattrs of a directory.
- DirTree
- An owned dirtree object: the lists of child files and subdirectories.
- Export
Stream Options push - The options of
Repo::export_stream. - Hashing
Reader - An async reader that hashes every byte that it yields.
- Hashing
Writer - An async writer that hashes every byte that it forwards.
- Image
- A composefs EROFS image in memory, with its fs-verity digest.
- Object
Name - A checksum and the type of the object that it identifies.
- RefPattern
- One ref pattern, with no
!. - RefSelector
- A list of positive and negative
RefPatterns. - Repo
Push Options push - The options of
Repo::pushandRepo::push_over_stream. - Span
- A half-open byte range of the input text that a
TextErrornames. - Text
Error - The error for a GVariant text form that
from_textrefuses. - Verifying
Reader - An async reader that verifies a stream against an expected checksum.
- Xattrs
- A sorted set of extended attributes, in canonical form.
Enums§
- Delta
Endianness - The byte order of the host-order size fields of a superblock.
- Lock
Kind - The kind of hold on the repository lock: shared or exclusive.
- Object
Type - A repository object type.
- Repo
Mode - The on-disk storage mode of a repository.
- Type
- A GVariant type.
- Value
- A dynamically typed GVariant value.
Constants§
- MAX_
METADATA_ SIZE - The size limit of a metadata object: 128 MiB.
- MAX_
REF_ ENTRY_ LEN - The most bytes in one entry of a ref listing request: 4,096.
- MAX_
REF_ ENTRY_ PARTS - The most parts in one entry of a ref listing request: 256.
- MAX_
REF_ LISTING - The largest ref listing: 128 MiB.
- MAX_
REF_ PATTERNS - The most entries in one request of a ref listing: 256.
Functions§
- from_
bytes - Deserializes normal-form GVariant bytes of type
tyinto aValue. - from_
text - Reads one GVariant text form and returns the type it states and the value.
- is_
checksum_ shaped - Returns
trueifnameis 64 lowercase hex characters. - is_
push_ address push - Returns
trueifremoteis a push address: a value with a:or a/. - loose_
path - Returns the loose path of an object for a repository mode.
- reap_
process_ staging - Removes the staging directories of the live transactions of this process.
- static_
delta_ relative_ dir - Returns the directory of a delta, relative to the repository root.
- to_text
- Renders
valueof typetyin the GVariant text form. - to_
text_ unannotated - Renders
valueof typetyin the GVariant text form with no annotations.