Skip to main content

Crate opys_bundle

Crate opys_bundle 

Source
Expand description

The bundle: a manifest and the blobs it names, as one file.

It is a zip, and deliberately nothing more — unzip -l reads it:

opys.json        the head: the bundle's format, and its options
manifest.json    the manifest, whole
blobs/<sha256>   one entry per blob

The head is about the bundle and the manifest is about the installation, and the two are kept apart for that reason. The head is the first entry and is stored uncompressed, so what a bundle is can be read with one seek, or off the front of the file by something that never parses a zip at all. It says the format and the options a player may set; whatever else is worth knowing about a bundle without decoding megabytes of manifest goes there.

manifest.json is a Manifest as opys-core reads and writes it, and nothing else: the container adds no spelling of its own.

Structs§

Bundle
An open bundle: its manifest, decoded, and its blobs, still in the file.
Choice
One value a select offers, and what to call it.
Directory
Where every entry of a bundle is, read off the end of the file.
Entry
One entry: where its bytes are in the file, and what they decode to.
EntryDecoder
Decodes an entry from the bytes of its range, as they arrive.
Head
What a bundle says about itself, apart from the installation it carries.
Label
What every option says about itself to the person choosing.
Options
A bundle’s options, checked as a whole: a tree that has been read is one a form can be drawn from without looking at it twice.

Enums§

Back
What the last bytes of a bundle give of its directory.
BlobSource
Where a blob’s bytes are before the manifest is published: a file on this machine, or bytes a plugin produced. This is build-machine state and is never part of a manifest — which is the whole difference from the file and bytes sources it replaces.
BundleError
Front
What the first bytes of a bundle give of its head.
Localized
Text a player reads. Kept as it was written, a string or a map, so that what is read back is what was written.
OptionDef
One option. name is the variable it fills or, for a Feature, the feature it switches.

Constants§

BUNDLE_FORMAT
The format this reader and writer speak. A bundle that says anything else is refused before another byte of it is interpreted.

Functions§

blob_id
The id of the blob holding exactly bytes.
blob_id_of
The id and length of the blob holding what reader yields, without holding it in memory.
directory_from_back
Read the directory of a bundle file_len bytes long from tail, its last bytes. Asks for more, by Back::Needs, until the tail holds it.
head_from_front
Read a bundle’s head off the front of the file, for a reader that has only that: a bundle behind a URL, asked for its first bytes.
is_language_tag
The shape of a BCP 47 tag, uk or pt-BR: a language of two or three letters, then subtags of one to eight letters or digits. Whether the language exists is not asked; a launcher that does not know it matches nothing and falls back to the head’s locale.
open_bundle
Open a bundle and decode its manifest. A manifest that names a blob the bundle does not hold is refused here, not halfway through an install.
read_bundle_head
Read a bundle’s head and nothing else. Costs the zip’s directory and a few bytes, whatever the bundle weighs.
write_bundle
Write manifest and the blobs it names as a bundle, under head.

Type Aliases§

Blobs
Blob id → where its bytes are. Ordered, because a bundle is written from it and must not differ between two builds of the same thing.