Expand description
Blocking HRRYFILE reads and writes over a caller-supplied transport (ADR-041 § 8).
The file container is addressed, not consumed: its trailer sits at size - 40, its
index is located from there, and tensors are found by name. So the reader here drives
hurray-io’s random-access core and asks the caller’s
read_at callback for absolute ranges, while the
writer emits one forward pass through write and never seeks back.
The division of labour is the stream surface’s, unchanged:
- the core decides which bytes it needs and never blocks,
- the transport moves them and MAY block,
- these handles carry counts between the two.
Scope: flat tensors, composites, and the KV metadata section. A composite is addressed
by its head’s name, read back whole by
hurray_file_reader_read_composite, and written from the preorder node array
HurrayCompositeNode describes.
Structs§
- Hurray
File Reader - Opaque handle to a blocking file reader.
- Hurray
File Writer - Opaque handle to a blocking file writer.
- Hurray
File Writer Options - Container options for a file writer.
- Hurray
KvEntry - One KV pair: a borrowed key and its value.
- Hurray
KvValue - One typed KV value: a
kindtag and the fields that tag selects.
Constants§
- HURRAY_
KV_ ARRAY - Homogeneous array of scalars:
itemsanditem_count. - HURRAY_
KV_ BOOL - Boolean:
bool_value. - HURRAY_
KV_ BYTES - Opaque bytes:
dataanddata_len. - HURRAY_
KV_ FLOA T64 - IEEE 754 binary64:
f64_value. - HURRAY_
KV_ INT64 - Signed 64-bit integer:
i64_value. - HURRAY_
KV_ STRING - UTF-8 string:
dataanddata_len. Not NUL-terminated. - HURRAY_
KV_ UINT64 - Unsigned 64-bit integer:
u64_value.
Functions§
- hurray_
file_ ⚠reader_ destroy - Destroys a reader, releases its transport context, and writes null through
handle. - hurray_
file_ ⚠reader_ kv_ count - Writes the number of entries in the file’s KV metadata section.
- hurray_
file_ ⚠reader_ kv_ entry - Copies KV entry
index— its key and its typed value — intoout_entry. - hurray_
file_ ⚠reader_ new - Opens a Hurray file over
transport: header, trailer, footer index and KV section. - hurray_
file_ ⚠reader_ read_ composite - Reads the composite headed by
name: its head, its members, and their members. - hurray_
file_ ⚠reader_ read_ descriptor - Reads the descriptor of the tensor named
name, without reading a byte of its data. - hurray_
file_ ⚠reader_ read_ tensor - Reads the tensor named
name: its descriptor and every data buffer. - hurray_
file_ ⚠reader_ tensor_ count - Writes the number of tensors in the file’s footer index.
- hurray_
file_ ⚠reader_ tensor_ name - Borrows the name of index entry
indexas UTF-8 bytes. - hurray_
file_ ⚠writer_ destroy - Destroys a writer, releases its transport context, and writes null through
handle. - hurray_
file_ ⚠writer_ finish - Writes the KV section, the footer index and the 40-byte trailer, completing the file.
- hurray_
file_ ⚠writer_ new - Creates a file writer over
transportand writes the 64-byte file header. - hurray_
file_ ⚠writer_ write_ composite - Writes a composite: its head, then every member in order, each with its own name and its own footer-index entry.
- hurray_
file_ ⚠writer_ write_ tensor - Writes one tensor under
name: its descriptor, its padding, then its data buffers.