Skip to main content

hurray_file_reader_read_composite

Function hurray_file_reader_read_composite 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn hurray_file_reader_read_composite( handle: *mut HurrayFileReader, name: *const u8, name_len: usize, out_item: *mut *mut HurrayItem, ) -> HurrayStatus
Expand description

Reads the composite headed by name: its head, its members, and their members.

Membership is recovered from the head’s declared member_count and the file order of the index entries that follow it, then validated — member count, partition exact-cover, overlay base-first ordering, at every level of nesting.

*out_item is owned by the caller and released with hurray_item_destroy, which frees every tensor in the subtree. Its nodes are in preorder, with each node declaring how many of the nodes after it are its members — see crate::item for the walk. Every member carries its own name, because every tensor in a file has its own index entry.

Returns:

  • HURRAY_OK — *out_item is a new HurrayItem.
  • HURRAY_ERR_NOT_FOUND — no such name in the index.
  • HURRAY_ERR_NOT_COMPOSITE — the name is in the index but its descriptor is not a composite head. Refused at descriptor time, before a byte of any data region is read.
  • HURRAY_ERR_INVALID_FILE — the group is torn: the head declares more members than follow it, or a level fails validation.
  • HURRAY_ERR_LIMIT_EXCEEDED — nesting exceeded the core’s maximum composite depth.
  • Whatever status the read_at callback returned, if it failed. Every request was an absolute range, so the reader stays usable and the call MAY be retried.

§Safety

  • handle MUST point to a live HurrayFileReader.
  • name MUST be readable for name_len bytes.
  • out_item MUST be a valid, non-null, writable pointer.