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§
- Entry
Side 🔒 - One side of a conflict, as the prompt shows it: a local entry’s metadata
or a host’s (
host_jobs). - HostJob 🔒
- A host transfer’s handle on its op: the same progress, failures, cancel
and conflict questions as a local copy’s (
host_jobs). - Job 🔒
- JobConfig
- Tunables, with test seams that production leaves unset.
- Jobs
- The ops in flight, and the slots they take turns on.
- Measure 🔒
- Entries and file bytes under a path, counted the same way as progress.
- OpControl
- One op’s controls, shared by its thread and the RPC handlers.
- Plan 🔒
- Plan
Item 🔒 - Question 🔒
- Raced 🔒
- The destination’s name was taken between the check and the write: look again (it is now a conflict, or a folder to merge into).
- Registered 🔒
- Removes an op from the registry when its thread ends.
- Slot 🔒
- One of the
max_concurrentworking slots.
Enums§
- Copy
Error 🔒 - Ending 🔒
- Host
Stop 🔒 - How a host transfer stopped early.
- How 🔒
- How to put an entry at its destination.
- Outcome 🔒
- What became of one entry and everything under it.
- Renamed 🔒
Constants§
- EVENT_
FILES_ OP - MPS event carrying an op’s progress. Scoped to
block:<id>; payloadFsOpEvent. - MAX_
KEEP_ 🔒BOTH - How many
name (n)candidates keep-both tries before giving up. - MAX_
RACE_ 🔒RETRIES - How many times one item is retried when its destination keeps appearing between the check and the write.
- PROGRESS_
INTERVAL 🔒 runningevents are sent at most this often (spec §10: one patch per ~100 ms). Every other state goes out at once.
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
Emitthat publishesfiles:optoblock:<block_id>. - describe 🔒
- An I/O error as a sentence naming the item.
- discard 🔒
- Remove a temporary file this job wrote. Best effort: the failure that led here is the one worth reporting.
- file_
name_ 🔒lossy - keep_
both 🔒 - Keep both:
putat the first freename (2),name (3)… besidedest. Each attempt is itself the existence check (putmust fail withAlreadyExistson a taken name), so a name taken by another writer between attempts moves on to the next number instead of overwriting. - lock 🔒
- A lock recovered if a panic elsewhere poisoned it: every holder leaves the guarded state consistent, and a poisoned lock must not wedge every later op.
- mtime_
ms 🔒 - Unix millis of a modification time, for the conflict prompt.
- numbered_
name 🔒 name (n).extfor a file,name (n)for a folder (whose dots aren’t an extension) or a name with no extension. Works on the raw name, so a name that isn’t valid Unicode keeps its bytes.- plan 🔒
- sibling_
temp 🔒 - A hidden, unique name beside
dest, in the same folder so a rename from it is never a cross-volume move. - verb 🔒