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.sizespacked entries.- varint
- Protobuf-style LEB128 varints.
Structs§
- Array
Iter - 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.
- Dict
Builder - Builds an
a{sv}dict value one entry at a time. - DirMeta
- An owned dirmeta object. Scalar fields are host-order.
- DirMeta
Ref - 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;
serializevalidates this. - DirTree
Ref - 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.
- Object
Name - 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.
- Text
Error - Why a GVariant text form was refused: the spans of the input it names, and
the reason.
fmt::Displayrenders the pair the way the tool reports it,<spans>:<reason>, with the spans separated by commas. - Xattrs
- A canonical, sorted xattr set.
- Xattrs
Ref - A borrowed view of a serialized
a(ayay)xattr set.
Enums§
- Error
- Errors produced by the core format primitives.
- 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.
Traits§
- GvDecode
- Decode normal-form GVariant bytes, borrowing from
datawhere possible. - GvType
- Type-level facts about a GVariant-encodable type: its signature, alignment,
and fixed size.
GvEncodeandGvDecodeboth 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 example10/7500...c7983.dirtree. - to_
bytes - Serialize
valueas typetyin GVariant normal form. - to_text
- Render
valueof typetyin the GVariant text form. - to_
text_ unannotated - Render
valueof typetyin the GVariant text form, with no type annotations. - write_
offset - Append one framing offset of width
z(as chosen bychoose_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.