Skip to main content

Module range

Module range 

Source
Expand description

Stable byte-range and lazy-open API for local or remote .rete files.

Structs§

BlockCacheReader
ByteRange
A byte range in the .rete file image.
CountingReader
Wraps a reader and tallies how many ranges were requested and how many bytes were returned — the metric that matters for a range-streamed format. Atomically counted, so it stays Sync (a lazily-faulting remote index holds its reader behind a shared loader).
LayoutSegment
One labelled byte region of a .rete file image (see Rete::file_layout). kind is a stable machine tag: header, metadata, dictionary, directory, tile, pyramid, named-graphs.
SliceReader
A RangeReader over an in-memory byte slice (tests, embedded files).
SummaryView
A lightweight, overview-only view of a file: the pyramid summary graph plus just enough dictionary to label predicates. Fetched via ranges without touching the (large) triple index — the “load the coarse graph first” path from SPEC.md §7.2.

Constants§

DEFAULT_BLOCK
Default block size: 64 KiB — large enough to swallow a dictionary chunk or an index tile in one fetch, small enough to keep over-fetch modest.
DEFAULT_CACHE_CAP
Default cap on resident cached bytes: 256 MiB. Large enough that a working set (the tiles + dictionary chunks a query family touches) stays warm; small enough that a full sweep of a multi-GB file leaves plenty of the 32-bit wasm address space for the decompressed structures built on top of these bytes. At the auto-tuned 128–512 KiB block sizes this is 512–2048 resident blocks, so the eviction scan is trivial.

Traits§

RangeReader
Something that can serve arbitrary byte ranges of a .rete resource.

Functions§

auto_block
Pick a BlockCacheReader block size from the file length: bigger files get bigger blocks so a remote query makes far fewer (but larger) round trips — 128 KiB ≤ 10 MB, 256 KiB ≤ 100 MB, 512 KiB above. The over-fetch is modest next to the round-trip latency it saves on a high-latency link (S3/CDN). Shared by the CLI and the wasm client so both size identically; the file length is known for free from the opening HEAD / Content-Range.
read_metadata_ranged
Fetch only the metadata section (the opaque Dataset Card blob) via a RangeReader: read the 128-byte header, then the metadata byte range — nothing else. This is the index-free CARD tier of the exploration model: a remote/S3 client learns the dataset’s self-description in two small range requests, never touching the dictionary, index, or pyramid. Returns None when the file carries no metadata.
read_schema_coherence_ranged
Dictionary-free Tier-0 coherence read. Fetch only the header and the pyramid-meta range (2 small range reads) and run schema_coherence over the schema pyramid — never touching the dictionary (which a literal-heavy file makes large) or the triple index. Ok(None) if the file ships no pyramid.
read_schema_summary_ranged
The schema summary (per-class histogram + class relations at the finest level) read over a RangeReader from the schema pyramid alone — the index-free, range-readable source for a Schema view of a remote graph. Returns (classes, relations) with classes = [(class_iri, count)] and relations = [(s_class, predicate, o_class, count)]; None when the file has no schema pyramid. Like read_schema_coherence_ranged, it reads only the trailing schema block, so it stays flat at any graph size.