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
//! Traits for paging chunks of merge-batcher state to and from backing storage.
//!
//! Modeled on timely's pager traits in
//! `timely-dataflow/communication/src/allocator/zero_copy/spill.rs`
//! (`SpillPolicy`, `BytesSpill`, `BytesFetch`), but parameterized over a chunk
//! type `C` rather than fixed to `timely::bytes::arc::Bytes`. For the columnar
//! batcher we expect `C = Updates<U>`; that wiring lives elsewhere — this file
//! only defines the trait shapes.
use VecDeque;
/// A queue entry: either an in-memory chunk or a handle that can fetch one
/// (or several) from backing storage.
/// Decides which queue entries to spill out and which to keep resident.
///
/// Invoked at well-defined moments by the holder of the queue (e.g., after
/// pushing a new chunk). The implementation may rewrite entries in either
/// direction: convert `Typed` to `Paged` (spill out) or `Paged` to `Typed`
/// (fetch back).
/// Move in-memory chunks to backing storage, returning fetch handles.
///
/// The implementation should drain from `chunks` and push to `handles` as it
/// goes; on failure it may stop partway, leaving the lists in a consistent
/// state that will be retried in the future. If it cannot leave the lists in
/// a consistent state it should panic.
/// Handle to spilled chunk(s). Consume to retrieve them from storage.