Skip to main content

Crate ostrya

Crate ostrya 

Source
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

§Modules

§Features

  • smol (default): the smol backend of ostrya-rt.
  • tokio: the tokio backend of ostrya-rt.
  • sign-spki: the spki module, 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 feature spki of ostrya-sign.
  • verify-gpg: the gpg module: the GPG verifier of ostrya-sign with the trait FromOstreeKeyrings, which reads the keyrings of a remote and the gpgkeys.gpg keyring of a repository through a repository handle, and the keyring management of a remote. It turns on the feature gpg of ostrya-sign.
  • sign-gpg: GpgSigner, which signs with the gpg command. It turns on verify-gpg.
  • sign-x509: X509Signer, the trait of a signer with an X.509 certificate chain for a CMS signature. With sign-spki, also X509SpkiSigner, SpkiSigner::with_certificates, SpkiVerifier::from_certificates, X509Chain, x509_crls, X509ChainSigner, and SigningKey::spki_x509, the X.509 chains and CRLs that an spki signature carries in the detached metadata, the keys certificate-chain-file and crl-file of a key group, the chain removal of Repo::delete_signatures, and the path check of the chains: X509Trust, x509_certificates, SpkiVerifier::with_x509, sign::load_x509_anchors, and the keys verification-spki-ca-file, verification-spki-intermediates-file, verification-spki-eku, and verification-spki-identity of a remote and of a trust group, and the revocation check: sign::load_x509_crls, the X.509 CRL cache of Repo::x509_crl_context and Repo::cache_x509_crls, and the keys verification-spki-crl-file and verification-spki-revocation of a remote and of a trust group. A build without the feature refuses these keys.
  • receive: the receive module, the receive side of a push.
  • push: Repo::push, Repo::push_onto, and Repo::export_stream, the push from a repository.
  • s3: the pull from a bucket repository at an s3:// address and the pull of collection refs from one, the bucket module with the fsck, the prune, and the summary update of a bucket repository, the s3 module of ostrya-remote, and with push, 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.
buckets3
Bucket repositories: repositories in archive form 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 config file.
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.
gpgverify-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.
receivereceive
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.
spkisign-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 summary file 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.
CommitRelations
The related commits of a commit, from Repo::read_commit_relations.
ComposefsImage
The open composefs image of a commit, from Repo::open_composefs_image.
DeltaFallback
An object that a static delta delivers as a loose object, outside its parts.
DeltaOpCounts
The number of operations of each opcode in the operation stream of a part.
DeltaOptions
The options of Repo::generate_static_delta.
DeltaPart
The meta-entry of one part of a static delta.
DeltaPartStats
The table sizes, the blob size, and the operation counts of one part.
DeltaSuperblock
A parsed static-delta superblock.
DictBuilder
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.
ExportStreamOptionspush
The options of Repo::export_stream.
HashingReader
An async reader that hashes every byte that it yields.
HashingWriter
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 config file.
Metadata
The logical metadata of a node.
ObjectName
A checksum and the type of the object that it identifies.
ParseRefError
The error of a ref that fails the rule of Ref::validate, or text that Ref does not read.
PushOntoOptionspush
The options of Repo::push_onto and Repo::push_onto_over_stream.
ReceiveSelector
A list of ReceivePattern entries that selects refs of each kind.
RefPattern
One ref pattern, with no !.
RefSelector
A list of positive and negative RefPatterns.
RelationWarning
A defective related value that Repo::prune or BucketRepo::prune read.
RepoPushOptionspush
The options of Repo::push and Repo::push_over_stream.
SendOptions
The options of Repo::send_with.
Span
A half-open byte range of the input text that a TextError names.
TextError
The error for a GVariant text form that from_text refuses.
VerifyingReader
An async reader that verifies a stream against an expected checksum.
Xattrs
A sorted set of extended attributes, in canonical form.

Enums§

ComposefsImageDefect
The defect of an image commit, or of the way that a commit names it, that Repo::open_composefs_image refuses with Error::InvalidComposefsImage.
ComposefsImageSource
The field of a commit that names the image commit that Repo::open_composefs_image opens.
ComposefsSupplementAdd
The result of Repo::add_composefs_supplement.
DeltaEndianness
The byte order of the host-order size fields of a superblock.
LockKind
The kind of hold on the repository lock: shared or exclusive.
ObjectType
A repository object type.
Ref
One ref of a repository.
RefNamespace
The namespace of a Ref, as Ref::namespace returns it.
RelationField
The field of a commit that holds a list of related entries.
RepoMode
The on-disk storage mode of a repository.
SendEvent
An event of a session of Repo::send_with, which SendOptions::on_event receives.
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 ty into a Value.
from_text
Reads one GVariant text form and returns the type it states and the value.
is_checksum_shaped
Returns true if name is 64 lowercase hex characters.
is_collection_id
Returns true if id is a collection id.
is_push_addresspush
Returns true if remote is a push address: a value with a : or a /.
is_valid_collection_id
Returns true if id is a valid collection id for a ref: it passes is_collection_id and is at most MAX_COLLECTION_ID_LEN bytes.
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 path under dfd, with all entries in it, except the entries that keep names.
source_date_epoch
Returns the value of the SOURCE_DATE_EPOCH environment variable, in seconds since the Unix epoch.
split_collection
Splits @ID:REST at the first : after the @.
static_delta_relative_dir
Returns the directory of a delta, relative to the repository root.
to_text
Renders value of type ty in the GVariant text form.
to_text_unannotated
Renders value of type ty in the GVariant text form with no annotations.

Type Aliases§

SendEventFn
The callback that receives each SendEvent of a session.