Skip to main content

Module selection

Module selection 

Source
Expand description

Ingest selection + backoff — pick the next due ingest in a --all rotation, skipping ones whose destination is unchanged and whose sources have not moved. Engine-side port of the plugin’s nextIngest / shouldSkip / backoff state.

The deterministic state (round-robin cursor, per-ingest backoff, one-shot ran-set) lives engine-side under <workspace>/.memstead.cache/ingest/ — the same engine-internal bookkeeping location the mtime memo uses. This is not mem-repo / graph state; selection mutates it as its job.

Backoff shape (mirrors the plugin exactly): a linear-ramp per-ingest skip counter. A destination-snapshot change or a moved source resets it to zero and runs; otherwise each unproductive pass grows the cooldown by one (capped at MAX_SKIP_LEVEL). A one-shot build never skips.

Structs§

BackoffEntry
Per-ingest destination-snapshot backoff state.
Cursor
The round-robin cursor — the ingest the last rotation advanced to.

Constants§

MAX_SKIP_LEVEL
The backoff cooldown ceiling — after this many consecutive unproductive passes the skip count stops growing. Mirrors the plugin’s MAX_SKIP_LEVEL.

Functions§

apply_backoff
Apply the destination-snapshot backoff to entry, mutating it, and return whether to skip this pass. current is the destination mem’s current snapshot token (empty when none). Mirrors the backoff block of the plugin’s shouldSkip:
select_next_due
Select the next due ingest for a --all rotation, advancing the round-robin cursor and the per-ingest backoff state. Returns the selected ingest name, or None when every eligible ingest is backing off this pass.
should_skip
Whether a binding should be skipped this rotation. A one-shot build never skips (one-shots are excluded from the eligible set once run). Discovery: a moved source overrides backoff; otherwise the destination-snapshot apply_backoff.