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§
- Backoff
Entry - 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.currentis the destination mem’s current snapshot token (empty when none). Mirrors the backoff block of the plugin’sshouldSkip: - select_
next_ due - Select the next due ingest for a
--allrotation, advancing the round-robin cursor and the per-ingest backoff state. Returns the selected ingest name, orNonewhen 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.