pub fn settle(
work_dir: &Path,
claimed: &Claimed,
state: &str,
) -> Result<(), String>Expand description
What:
Move a claimed item to done (or to failed), after the consumer’s result is durable.
Why:
A crash before this rename leaves the item claimed, and its lease runs out; the work is then done again, so a
handler must tolerate a repeat.
In TS you’d write (pseudocode):
await rename(join(workDir, 'claimed', id), join(workDir, 'done', id))