Expand description
Disposal of a snapshot’s trash: the work item, the foreground fallback and the service’s handler. What: The disposal of the trash a snapshot’s leave-out made: hand it to the commit service as a work item, or empty it here when the service cannot be reached, and the service’s handler. Both delete only the directory the leave-out recorded and only the entries it recorded, found by walking down from the worktree’s handle without following a link. Why: A name of forty hexadecimal digits proves nothing about who made a directory, and a path string is resolved again by every call that takes it. The manifest says which objects the leave-out made and moved; the disposal opens each directory on the way by one plain name below the handle of the one above, compares identities, and leaves anything else alone with a reason. A record stays until the trash is gone or the service has taken it, so a failure is never a silent success.
In TS you’d write (pseudocode):
await disposePendingTrash({ context, destination, gitDir, trash, notices }); // throws the reason the trash staysStructs§
- Reach
- How the service is reached: where its address is found, how it is set up, and how long its start is waited for.
Constants§
- TRASH_
REFERENCE - The reference every trash work item carries; the service accepts only a reference under
refs/.
Functions§
- delete_
trash - What:
Empty the trash directory the manifest describes, in the worktree
repositorywhose administrative directory isgit_dir; a trash that is already gone is done. Why: Every directory from the worktree down is opened by one plain name below the handle of the one above, so a link at any level is an error and never followed. The trash is the directory with the recorded identity, each entry in it is removed only when it is the object that was moved there, and anything else in the trash stays with a reason. - dispose_
pending_ trash - What:
Dispose of the trash a snapshot made in the new worktree
destination, when it made one. Why: The wrapper never starts the service itself; writing the record and connecting to its socket does. A trash that no one empties is only disk, but the foreground fallback means the worktree never keeps one past the command that made it, and a trash that cannot be emptied is reported with its path and the reason. - dispose_
pending_ trash_ with dispose_pending_trashfor a known trash, with the route finder and the wait for a current service injected, so a control can use a fixture service and a short wait.- empty_
trash - What:
The service’s handler: empty the trash directory a work item names, after checking that it is the one the snapshot made.
Why:
The record is a file in the Git directory; the handler trusts nothing in it beyond what it can verify: the worktree’s
.gitfile points at the record’s Git directory, every directory down to the trash is a real one, the trash has the recorded identity, and each entry removed is the recorded object.
Type Aliases§
- Provisioner
- Sets up what the service needs before it can be reached, as a commit does for its first message; injected so a control never reaches the session bus.
- Router
- How the service’s address is found for a Git directory; injected so a control never reaches the real service.