Skip to main content

Module jobs

Module jobs 

Source
Expand description

Copy and move as background jobs: fs.op.start, fs.op.resolve, fs.op.cancel, with progress published as files:op events.

Each op runs on its own std thread, never on the async runtime: copying blocks for as long as the disk takes, and a conflict blocks until the user answers. At most JobConfig::max_concurrent ops work at once; the rest wait their turn, reported as running with no progress.

The rules every step follows, because each guards against losing data:

  • A file is written under a temporary name in the destination folder and only then renamed into place, so a partial file never carries the real name, and canceling or failing removes it.
  • Replace never truncates: a file over a file is a rename over it; any other replace first moves the old entry aside and puts it back if the new one can’t be put in its place.
  • A move deletes a source only after its copy fully succeeded; a folder is removed only once everything inside it was moved.
  • No step follows a link: links are copied as links, never walked.
  • Nothing that exists is overwritten without an answer: every create is a create-new or a no-replace rename, so a name taken in the meantime is a fresh conflict, not a silent overwrite.

Spec: docs/specs/SPEC_FILE_BROWSER_PANE_2026_10_01.md §7.1, §7.2, §9.

Structs§

JobConfig
Tunables, with test seams that production leaves unset.
Jobs
The ops in flight, and the slots they take turns on.
OpControl
One op’s controls, shared by its thread and the RPC handlers.

Constants§

EVENT_FILES_OP
MPS event carrying an op’s progress. Scoped to block:<id>; payload FsOpEvent.

Statics§

JOBS
The process-wide job registry behind the fs.op.* handlers. Process-wide rather than per connection, so a window reload doesn’t orphan an op.

Functions§

broker_emitter
The Emit that publishes files:op to block:<block_id>.

Type Aliases§

Emit
Delivers an op’s events. In production, a files:op publish scoped to the block that started it.