A depot release retires a temporary bridge, stops new dispatch work, and publishes new bay ownership with matching repair windows. Model each operation at its actual boundary. The edge timeline is a known batch of add, remove, and ask events. The queue is an in-process FIFO with a close state. The paired indexes are immutable snapshots published under one process lock. A page redo list demonstrates which committed changes replay after a simulated interruption. These four mechanisms answer different questions; none alone supplies a durable multi-process transaction.
Project: plan a reversible depot release
Connectivity and queue contract
Process six timeline events: add D-19 to D-26; ask whether D-19 reaches D-47; add D-26 to D-47; ask again; remove that second edge; ask once more. Require false, true, false. Reject adding the same active edge twice and removing an inactive edge. Next, fill a two-slot dispatch queue with J-47 and J-52. A nonblocking third offer fails. Close the queue, then drain J-47 and J-52 in order before a final take signals closure. Test a blocked producer and a blocked consumer separately: both must wake when the queue closes, with the producer's new offer rejected.
Publication and replay contract
Capture an inventory snapshot containing bays 47 and 52. Retire 47 and add 61 with [47, 58) as its repair window. A reader retaining the old snapshot still sees 47; a new reader sees version 2 with 52 and 61. An orphan window must fail before publication. For page replay, record one committed update to P-19 and P-26, then an unfinished update to P-52. Recovery from the checkpoint applies only the committed group. State the missing storage guarantees: the Python list has no durable flush order, torn-record validation, or undo for a page that was written before its transaction committed.
Acceptance trace
D-19 to D-47 by event: false, true, false
Third queued job: refused; accepted jobs drain before closed
Old bays: 47, 52; new bays: 52, 61
Recovered pages: P-19, P-26; unfinished P-52 absentCost and boundary review
For Q events and I active-edge intervals, time-tree assignment stores O(I log Q) interval references. Union-by-size rollback adds logarithmic find cost without path compression. Queue insertion and removal take O(1) work while holding a lock, but blocking time has no fixed bound. Full map-copy publication takes O(B + W) time and memory for B bays and W windows per retained version. Journal replay scans its records and committed updates linearly. These costs describe the shown algorithms. A production release needs explicit durable ordering, a commit record that survives power loss, and a rule for readers in other processes. Write separate tests for those requirements.
Common Mistakes
- Do not answer an online edge update with a batch algorithm that assumes future events are known.
- Do not leave blocked queue threads asleep when close changes the state they await.
- Do not mutate a value object inside an old shallow snapshot.
- Do not replay an unfinished page group as committed.
- Do not mistake a consistent in-process pointer swap for power-loss durability.
Connected lessons
- Offline connectivity: edge lifetimes and rollback unions
- Bounded queues: close, wake waiters, and drain accepted work
- Index snapshots: publish related maps as one in-memory version
- Page journals: replay committed index changes
- Project: release a warehouse plan after indexed mutations
- Projects
- Quizzes
- Data Structures
