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, and
Repo::push_onto asks a remote to commit the tree of a local commit. With
the receive feature, the receive module takes a push on the server side.
With the push and s3 features, Repo::push_to_bucket writes commits to
a bucket repository in an S3 bucket, BucketRepo::push_tree writes a local
directory to one as a new commit, and BucketRepo::init creates one.
§Entry points
Repo::openandRepo::creategive aRepo, the handle of a repository.OpenOptionsandCreateOptionsgive aRepowith options, such as aRemotesDir.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_reportandRepo::pull_local_with_reportalso list the refs that the pull changed.Repo::pull_with_sessioncopies commits from a remote through a session of the caller.Repo::pull_collectioncopies the refs of a collection from the remotes that serve it.Repo::export_mediacopies the commits of collection refs onto removable media.Repo::import_mediapulls collection refs from removable media, under the trust of their remotes.Erroris the error of each fallible operation ofRepo,Transaction, and the other handles.
§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. - Removable media:
media, the export of collection refs onto a mounted volume, and the import from it. - Push and receive:
remote, the wire protocol ofostrya-remote, andreceive. - Client access:
access, the client groups and the server settings of the config, the claims of a client certificate, and the read rights of a client. - Remote resolution:
endpoint, which reads the keys and files of a remote for a pull or a push. - Bucket repositories:
bucket, a repository in an S3 bucket, with the init, the writer lock, the listing of the objects, the fsck, the prune, and the summary update. - Signing:
sign,gpg, andspki. - Signature trust:
verify, the trusted keys, the trust of one pull, and the verifiers of one remote. - Config:
config, a type for each key of the repositoryconfig, andconfig_group!, which defines the keys of a group. - Maintenance:
prune,fsck,diff, andupdate. - 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 with each of its key types: ECDSA P-256, ECDSA P-384, Ed25519, RSA, ML-DSA-44, ML-DSA-65, and ML-DSA-87, and the 12 parameter sets of SLH-DSA. It turns on the featurespkiofostrya-sign.verify-gpg: thegpgmodule: the GPG verifier ofostrya-signwith the traitFromOstreeKeyrings, which reads the keyrings of a remote and thegpgkeys.gpgkeyring of a repository through a repository handle, and the keyring management of a remote. It turns on the featuregpgofostrya-sign.sign-gpg:GpgSigner, which signs with thegpgcommand. It turns onverify-gpg.sign-x509:X509Signer, the trait of a signer with an X.509 certificate chain for a CMS signature. Withsign-spki, alsoX509SpkiSigner,SpkiSigner::with_certificates,SpkiVerifier::from_certificates,X509Chain,x509_crls,X509ChainSigner, andSigningKey::spki_x509, the X.509 chains and CRLs that an spki signature carries in the detached metadata, the keyscertificate-chain-fileandcrl-fileof a key group, the chain removal ofRepo::delete_signatures, and the path check of the chains:X509Trust,x509_certificates,SpkiVerifier::with_x509,sign::load_x509_anchors, and the keysverification-spki-ca-file,verification-spki-intermediates-file,verification-spki-eku, andverification-spki-identityof a remote and of a trust group, and the revocation check:sign::load_x509_crls, the X.509 CRL cache ofRepo::x509_crl_contextandRepo::cache_x509_crls, and the keysverification-spki-crl-fileandverification-spki-revocationof a remote and of a trust group. A build without the feature refuses these keys.receive: thereceivemodule, the receive side of a push.push:Repo::push,Repo::push_onto, andRepo::export_stream, the push from a repository.s3: the pull from a bucket repository at ans3://address and the pull of collection refs from one, thebucketmodule with the fsck, the prune, and the summary update of a bucket repository, thes3module ofostrya-remote, and withpush, the push of commits and of a local directory to a bucket 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_core::config_group;pub use ostrya_fetch as fetch;pub use ostrya_remote as remote;
Modules§
- access
- The client groups and the server settings of a repository config.
- 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.
- bucket
s3 - Bucket repositories: repositories in
archiveform in an S3 bucket. - 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.
- media
- The export of collection refs onto removable media, and the import from them.
- 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 an open and of a new repository.
- sign
- Commit signatures, the signing engines, and the key store.
- spki
sign-spki - The spki signing engine: ECDSA P-256 and P-384, Ed25519, RSA PKCS#1 v1.5, ML-DSA, and SLH-DSA signatures, 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, the trust of one pull, and the verifiers of one remote.
Structs§
- Checksum
- A 32-byte SHA-256 checksum that names an object.
- Commit
- An owned commit object.
- Commit
Relations - The related commits of a commit, from
Repo::read_commit_relations. - Composefs
Image - The open composefs image of a commit, from
Repo::open_composefs_image. - 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.
- KeyFile
- A parsed key file, such as the repository
configfile. - Metadata
- The logical metadata of a node.
- Object
Name - A checksum and the type of the object that it identifies.
- Parse
RefError - The error of a ref that fails the rule of
Ref::validate, or text thatRefdoes not read. - Push
Onto Options push - The options of
Repo::push_ontoandRepo::push_onto_over_stream. - Receive
Selector - A list of
ReceivePatternentries that selects refs of each kind. - RefPattern
- One ref pattern, with no
!. - RefSelector
- A list of positive and negative
RefPatterns. - Relation
Warning - A defective related value that
Repo::pruneorBucketRepo::pruneread. - Repo
Push Options push - The options of
Repo::pushandRepo::push_over_stream. - Send
Options - The options of
Repo::send_with. - 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§
- Composefs
Image Defect - The defect of an image commit, or of the way that a commit names it, that
Repo::open_composefs_imagerefuses withError::InvalidComposefsImage. - Composefs
Image Source - The field of a commit that names the image commit that
Repo::open_composefs_imageopens. - Composefs
Supplement Add - The result of
Repo::add_composefs_supplement. - 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.
- Ref
- One ref of a repository.
- RefNamespace
- The namespace of a
Ref, asRef::namespacereturns it. - Relation
Field - The field of a commit that holds a list of related entries.
- Repo
Mode - The on-disk storage mode of a repository.
- Send
Event - An event of a session of
Repo::send_with, whichSendOptions::on_eventreceives. - Type
- A GVariant type.
- Value
- A dynamically typed GVariant value.
Constants§
- COMPOSEFS_
RELATION - The name of the attachment and of the supplement that names the composefs image commit of a commit.
- 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_
collection_ id - Returns
trueifidis a collection id. - is_
push_ address push - Returns
trueifremoteis a push address: a value with a:or a/. - is_
valid_ collection_ id - Returns
trueifidis a valid collection id for a ref: it passesis_collection_idand is at mostMAX_COLLECTION_ID_LENbytes. - 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.
- remove_
source_ tree - Removes the source tree at
pathunderdfd, with all entries in it, except the entries thatkeepnames. - source_
date_ epoch - Returns the value of the
SOURCE_DATE_EPOCHenvironment variable, in seconds since the Unix epoch. - split_
collection - Splits
@ID:RESTat the first:after the@. - 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.
Type Aliases§
- Send
Event Fn - The callback that receives each
SendEventof a session.