Skip to main content

Module context

Module context 

Source
Expand description

Context state nodes: non-deterministic, session-scoped values.

These nodes produce values from the execution environment rather than the coordinate space. They break the deterministic model and should be used deliberately.

All authoring goes through #[polydat_node]. Three shapes appear here:

  • Pure clock / OS reads (current_epoch_millis, thread_id) โ€” plain body, marked Nondeterministic.
  • Construction-frozen captures (tmp_dir, env_or) โ€” use #[poly_const(setup_fn, from = ())] (or from = <const_arg> when the capture depends on a const) to compute the cached value once at construction. The body just reads the cache.
  • Fallible construction (env) โ€” body returns Result<String, String>. The macro emits try_new and propagates Err as a workload-compile error via the build closure.

Structsยง

Counter
Monotonic counter (non-deterministic).
CurrentEpochMillis
Current wall-clock time in epoch milliseconds.
Env
Environment variable read, frozen at construction.
EnvOr
Environment variable read with default, frozen at construction.
Limit
Cursor limit: passes the input value through unchanged.
ThreadId
Current OS thread numeric identifier.
TmpDir
System temp directory, frozen at construction.