Skip to main content

Module file

Module file 

Source
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§

HurrayFileReader
Opaque handle to a blocking file reader.
HurrayFileWriter
Opaque handle to a blocking file writer.
HurrayFileWriterOptions
Container options for a file writer.
HurrayKvEntry
One KV pair: a borrowed key and its value.
HurrayKvValue
One typed KV value: a kind tag and the fields that tag selects.

Constants§

HURRAY_KV_ARRAY
Homogeneous array of scalars: items and item_count.
HURRAY_KV_BOOL
Boolean: bool_value.
HURRAY_KV_BYTES
Opaque bytes: data and data_len.
HURRAY_KV_FLOAT64
IEEE 754 binary64: f64_value.
HURRAY_KV_INT64
Signed 64-bit integer: i64_value.
HURRAY_KV_STRING
UTF-8 string: data and data_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 — into out_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 index as 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 transport and 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.