Bins
Each station has five bins, folders under temp/stations/IN1/ for station IN1. A workpiece is in exactly one bin of one station at any moment, and that bin is its state. To see where work stands, list the folders.
Every bin of a factory lives under its temp/ folder, on one disk. So moving a workpiece from one bin to another, within a station or from one station to the next, is a rename: instant, whatever the workpiece's size.
| Bin | Holds | Means |
|---|---|---|
input | Workpieces waiting for this station | Not started here |
doing | A working copy of the workpiece being processed | In progress, or left over from a crash |
output | Workpieces this station finished, with its files added | Done here; the next station takes it from here |
done | An untouched copy of each input this station finished | A receipt |
failed | The untouched input, its log, and the error | Tried here and couldn't finish |
How a workpiece moves through a station
- Copy
input/inv-1001/todoing/inv-1001/. - Work only on the copy in
doing/: read files, write new ones, add events tolog.jsonl. - On success, move
doing/inv-1001/tooutput/and move the originalinput/inv-1001/todone/. - On failure, move the original to
failed/. Add the log fromdoing/and the error, then delete the copy indoing/.
The input is never edited. That gives three guarantees:
outputholds only finished work. The next station never picks up something half-written.doneis a receipt of exactly what the station was given, byte for byte, for audits and comparisons.failedholds what the station was given, plus why it failed. To try again, move it back toinput.
The next station takes work from output, never from done. done is the record of what came in, not something to pass on.
Sub-bins: grouping work in output
A station that sorts its work can put folders inside output that group workpieces by kind. A classifier files documents under output/invoices/ and output/receipts/. A station that finds several documents in one sends the parts back through the line head instead: see Splitting work. A sub-bin has no pointer.json of its own, so it is never mistaken for work.
Each downstream station takes from the sub-bin it handles: IN1/output/invoices feeds the invoice line, and IN1/output/receipts feeds another. Name a sub-bin after what it holds, not after the station that filled it. Once a station's output/ has any sub-bin, every finished workpiece goes into one; none sit bare at the top. A checking station files work by its verdict.
Why folders, not a database
- Nothing to set up or keep in sync. The folder is the state.
- Anyone can see it with
ls,findorwc -l. - A move between bins is a rename, done all at once on one disk.
The limits: it isn't built for thousands of moves a second; there are no queries, so counting across stations means listing folders; and a bin with tens of thousands of folders is slow to list. Clear old done/ copies you no longer need, but keep the ones a redo may start from.
Related
- The doing bin: why work happens on a copy
- Stations pull work: how a workpiece gets from one station's
outputto the next station'sinput - Nothing leaves silently: what belongs in
failed, and what doesn't - Find out why a workpiece failed: reading
failedand retrying - Fix the line, not the output:
done/is where a redo starts