1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! I/O worker thread — drains the bounded queue and runs
//! `backend.write_blob` / `backend.flush` on behalf of the
//! checkpoint planner.
//!
//! ## Why a separate thread
//!
//! Decouples I/O execution from planning so the planner can:
//! 1. Snapshot bytes under a brief shared read guard, then move on.
//! 2. Submit N flush tasks without serialising on each I/O.
//! 3. Plan the next round's merge pass while the previous round's
//! Sync is still in flight on the I/O thread.
//!
//! For the current local-`pread`/`pwrite` backend the parallelism
//! gain is modest (single thread, single FD). The architecture
//! pays off once the io_uring backend lands (next commit) — the
//! I/O thread becomes the SQE submitter + CQE poller, and the
//! planner's submit-N-then-wait pattern naturally feeds the ring.
//!
//! ## Shutdown
//!
//! The thread terminates on receiving [`IoTask::Stop`]. The
//! `Checkpointer` orchestrator sends one at the end of its `Drop`
//! sequence, after the final synchronous round has drained
//! everything through this same queue.
use ;
use Arc;
use crateResult;
use crateBlobGuid;
use crateAlignedBlobBuf;
use Shared;
/// One-shot completion channel — sized `bounded(1)` so a `send`
/// never blocks. The I/O worker sends `Ok(())` on success and
/// `Err(_)` on failure; the orchestrator receives once.
pub type Completion = ;
/// Work item handed to the I/O thread via the bounded queue.
pub
/// Main loop for the I/O thread.
pub