Expand description
Data sources: typed sequences that drive workload iteration.
A source is a data provider with identity. It knows what it yields (schema), how much it has (extent), where the consumer is (cursor), and how to partition across concurrent fibers.
Sources replace the cycles counter as the workload iteration driver.
A Polydat program declares one with the cursor keyword
(cursor q = range(0, N) [over <partition>]). A host pulls from
sources to drive dispatch; when a source is exhausted, the activation
is done.
§Source Types
- Range:
range(0, N)— a finite sequence of ordinals, served byRangeSourceFactory. Replacescycles: N. - Extending:
until_elapsed(base, min_ms[, delta])and the otheruntil_*constructors, compiled to aCursorKind::Extending*and served byExtendingRangeSourceFactory. - Host-supplied: any
DataSourceFactorya host implements, such as a dataset reader whose items carry vectors or metadata; this crate ships only the range factories.
§Crate Sovereignty
All source API surface lives here in polydat-core, re-exported by
polydat at polydat::iteration::source. Host runtimes and adapters
consume these types but don’t define them.
Structs§
- AndPolicy
- Continue (extend) while ALL child policies say continue.
Stops the moment any child policy returns
None. The delta is the minimum of the children’s deltas — conservative step size keeps any single condition from over-shooting its stop point. - Cursors
- Provenance-driven advancer that targets only the cursor nodes relevant to a specific set of output fields.
- Extending
Range Source Factory - Factory for ExtendingRangeSource. Differs from
RangeSourceFactoryin thatendis an atomic that the extension policy may grow over the lifetime of the phase.global_extent()returns the CURRENT end so phase-status displays reflect any growth honestly. - Extension
Context - Snapshot of cursor state passed to an
ExtensionPolicyat each end-reach decision point. Policies are pure predicates over this context — they don’t carry their own clocks or counters. - OrPolicy
- Continue (extend) while ANY child policy says continue.
Stops only when every child policy returns
None. The delta is the maximum of the policies that said continue — matches the most aggressive child still pushing forward. - Ordinal
Batch Lease - Ownership token for one range reserved from a perfect ordinal source.
- Range
Source Factory - Factory for range sources. Shared atomic cursor distributes ordinals across fibers.
- Source
Item - A single item yielded by a source.
- Source
Replay Contract - Runtime source capability used by offset-stamped batch plans.
- Source
Schema - Schema describing what a source yields.
- Time
Elapsed Policy - Back-compat alias for the original time-only policy.
Constructs an
UntilElapsedPolicywith delta = base. - Until
Count Policy - Extend by
deltawhilectx.consumed < min_count. - Until
Elapsed Policy - Extend while
ctx.elapsed_ms < min_ms, projecting the remaining work from the observed rate and committing it in one batch. - Until
Passes Policy - Extend by
deltawhilectx.passes() < min_passes. Passes are whole multiples ofctx.base.
Enums§
- Cursor
Batch Error - Why a cursor batch could not be reserved.
- Cursor
Kind - Cursor-construction discriminator. Set by the Polydat compiler
when it recognises a cursor’s constructor expression
(
range(...),until_elapsed(...), etc.); read by the executor at phase setup to instantiate the matching data-source factory + policy. - Source
Replay Stability - Whether a source item can be reconstructed from its ordinal without consulting or advancing mutable source state.
- Source
Value Form - A compact description of values which can be generated without rendering an opaque source item first.
Traits§
- Data
Source - Consumption API for data sources. One instance per fiber.
- Data
Source Factory - Factory that creates per-fiber
DataSourcereaders. - Extension
Policy - Policy that decides whether to extend an
ExtendingRangeSourcewhen its current end is reached.