Expand description
Cursor partition specs — SRD 71.
Value types and a small spec language following the token
grammar chunking [in window] [order]:
PartitionSpec— the parsed-but-unresolved form of acursor=...argument: aChunking(Form 1 single sub-range, Form 2 delta list, or Form 3 pre-baked recipe, as typedBounds), an optionalin start..endwindow, and aPartitionOrder.Partition— a single resolved partition with concrete absolute ordinals, computed byresolvefrom aPartitionSpecagainst a known base extent.
The parser and resolution math live
here; the DSL over clause and cursor source factory
integration live in their own modules. The Polydat Value
integration rides on the existing Value::Ext /
ReflectedValue mechanism — see the impls below.
Structs§
- Partition
- A single resolved partition: an absolute ordinal range with derived percentage and index metadata.
- Partition
List - A list of resolved partitions carried as a single Polydat value.
- Partition
Spec - Parsed
cursor=...argument:
Enums§
- Bound
- One numeric boundary or list token inside a partition spec. The forms are distinguished syntactically at parse time:
- Chunking
- The chunking part of a spec — the shape that carves a domain into partitions. Two shapes:
- Partition
Order - Iteration order for a resolved partition list — the optional
trailing keyword of a spec (
"fib:5 largest_first").
Functions§
- cursor_
extent - The extent a cursor resolves partitions against: the schema’s static
extent when known, otherwise the difference of its extent outputs
pulled from
state. - cursor_
extent_ on cursor_extentthrough theKerneltrait, for a kernel on any engine.- cursor_
over_ partitions - Resolve the partitions a cursor’s
overclause denotes: the list the compiler resolved at build when the clause and the extent were constant, otherwise the rawovervalue pulled fromstateagainst the extent. Returns an empty list for a cursor without anoverclause. The interpreter-state form ofcursor_over_partitions_on, which does the same on a kernel of any engine. - cursor_
over_ partitions_ on cursor_over_partitionsthrough theKerneltrait, for a kernel on any engine.- cursor_
slot_ writes - The inputs narrowing a cursor to one partition writes, by name: the
<cursor>__cursorslot and its six scalar projections. This is whatnarrow_cursorwrites on the interpreter andset_cursoron every compiled kernel. - narrow_
cursor - Write one resolved partition into a cursor’s
<cursor>__cursorslot and its six scalar projection slots. Slots the program does not declare are skipped. The interpreter-state form ofset_cursoron theKerneltrait, which does the same on a kernel of any engine. - parse
- Parse a
cursor=...spec string into aPartitionSpec. - resolve
- Resolve a
PartitionSpecagainst a cursor’s base extent[base_start, base_end), producing a list of concretePartitions with absolute ordinals. - resolve_
over - Resolve the value of an
overexpression into the partitions it denotes, against a cursor ofextentordinals. - split_
evenly - Split
[start_ord, end_ord)intoncontiguous half-open chunks whose sizes differ by at most one ordinal. Boundaryisits atstart_ord + round(i * span / n), so the rounding slack is distributed across the chunks rather than accumulating in the last one.nmust be >= 1. - subdivide_
partition - Split a resolved
Partitionintoncontiguous sub-partitions whose sizes differ by at most one ordinal — the value-level form of the*/Nspec token (identical boundary math viasplit_evenly). Indices restart at 0,countisn,base_extentpropagates, and the pct fields interpolate the parent’s span.