Skip to main content

Crate ostrya_core

Crate ostrya_core 

Source
Expand description

ostree object model, checksums, and on-disk format primitives.

Builds on the ostrya-gvariant codec to serialize and parse commits, dirtrees, dirmeta, and file headers, and provides the checksum type, LEB128 varint, loose-path derivation, ostree.sizes packing, and xattr canonicalization.

This crate covers phases 2 and 3 of the port plan (see docs/port-plan.md): the format primitives (checksum, varint, loose paths, sizes, xattrs, keyfile) and the typed object structs (commit, dirtree, dirmeta, file headers) with their borrowed read-path views.

Re-exports§

pub use filehdr::ContentHasher;
pub use filehdr::FileHeader;

Modules§

base64
General standard-alphabet base64 for arbitrary-length byte strings.
filehdr
File content-object headers and the content checksum.
sizes
ostree.sizes packed entries.
varint
Protobuf-style LEB128 varints.

Structs§

ArrayIter
A decoded array: a lazy iterator that decodes one element per step.
Checksum
A 32-byte SHA-256 object id.
Commit
An owned commit object. The timestamp is host-order seconds since the Unix epoch, UTC.
DictBuilder
Builds an a{sv} dict value one entry at a time.
DirMeta
An owned dirmeta object. Scalar fields are host-order.
DirMetaRef
A borrowed view of a serialized dirmeta object. The scalar fields decode on parse; the xattrs stay lazy.
DirTree
An owned dirtree object. Both lists must be name-sorted (byte-wise, strictly increasing) and no name may appear in both lists; serialize validates this.
DirTreeRef
A borrowed view of a serialized dirtree object.
KeyFile
A parsed key file: an ordered list of groups, each an ordered list of (key, raw value) entries.
ObjectName
A checksum together with the object type it identifies.
Span
A half-open byte range of the input text, as the refusal messages report it.
TextError
Why a GVariant text form was refused: the spans of the input it names, and the reason. fmt::Display renders the pair the way the tool reports it, <spans>:<reason>, with the spans separated by commas.
Xattrs
A canonical, sorted xattr set.
XattrsRef
A borrowed view of a serialized a(ayay) xattr set.

Enums§

Error
Errors produced by the core format primitives.
ObjectType
A repository object type.
RepoMode
The on-disk storage mode of a repository.
Type
A GVariant type.
Value
A dynamically-typed GVariant value.

Traits§

GvDecode
Decode normal-form GVariant bytes, borrowing from data where possible.
GvType
Type-level facts about a GVariant-encodable type: its signature, alignment, and fixed size. GvEncode and GvDecode both require it, so a type states these three constants once for both directions.

Functions§

choose_offset_size
The smallest offset size whose representable range covers the container’s total size (data plus the framing offsets themselves). The parser derives the same size from the total, so both sides agree.
from_bytes
Deserialize normal-form GVariant bytes as ty.
from_text
Read one GVariant text form, returning the type it states and the value.
loose_path
The loose path of an object relative to the objects/ directory, for example 10/7500...c7983.dirtree.
to_bytes
Serialize value as type ty in GVariant normal form.
to_text
Render value of type ty in the GVariant text form.
to_text_unannotated
Render value of type ty in the GVariant text form, with no type annotations.
write_offset
Append one framing offset of width z (as chosen by choose_offset_size). A container’s offsets are written after its data, in reverse member order for a tuple and in member order for an array.

Type Aliases§

Result
Result alias for the core format primitives.