Skip to main content

Module interrupt

Module interrupt 

Source
Expand description

Graceful Ctrl-C for decdn get, decdn pool open and decdn pool top-up.

The first Ctrl-C resolves Interrupt::wait: the command stops its transfers, writes what it must keep (the bundle skip-cache, the progress indicators’ cleanup), and returns Interrupted, which exits with status 130. A second Ctrl-C, or one that arrives after the command stops watching, exits at once with the same status.

Stopping mid-transfer loses nothing already paid for: every fetch resumes from its on-disk .partial on the next run. A decdn get run whose destination is relative keeps that state under the current directory, so its stop line names the directory to run the command again from (ResumeFrom). Stopping an openPool or a topUp before its record commits does not cancel the transaction, so the command names it (name_held_escrows, and the immediate exit) instead of telling the user to run it again: a re-run before it confirms escrows a second time. An escrow that mined with no local record crediting it is named the same way: a re-run reads the uncredited row and escrows again.

Structs§

Interrupted
The error a command returns when Ctrl-C stopped it. main prints stop_message and exits with status 130 (128 + SIGINT), the shell convention for an interrupted command.
ResumeFrom
The directory a stopped command must run again from to resume: the one its relative destination, and so its resume state, resolves against (the .partial files, and a bundle’s .decdn-partial/ and .decdn-bundles/). Attached to an Interrupted or a GaveUp, so stop_message names it.
UnreconciledEscrows
The openPool and topUp transactions a command ended with that someone must reconcile against the chain: those it did not see confirm, which may still escrow USDC, and those that escrowed with no local record crediting them. Displays one per line.

Constants§

GAVE_UP_EXIT
The exit status for a fetch that gave up after its no-progress limit: EX_TEMPFAIL, since a rerun resumes it.
INTERRUPTED_EXIT
The exit status for an interrupted command: 128 + SIGINT.

Functions§

stop_exit
The exit status for a command that stopped rather than failed: INTERRUPTED_EXIT for a Ctrl-C, and GAVE_UP_EXIT for a give-up. None for any other error, and for a give-up with an openPool or topUp in flight or untracked: EX_TEMPFAIL tells a wrapper that a re-run is safe, and that one is not.
stop_message
The line main prints for a command that stopped rather than failed: a Ctrl-C, or a give-up after the no-progress limit. None for any other error. The advice to run the command again, after a Ctrl-C or a give-up, names the ResumeFrom directory when the error carries one. An openPool or topUp in flight or untracked replaces that advice, because a re-run before it is reconciled escrows again.