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
95
96
97
98
99
100
101
102
103
104
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright The Infino Authors
//! Hierarchical lazy-load helper.
//!
//! The bridge between the list-level prune helpers
//! (`list_prune::prune_parts_for_*`) and the per-part
//! superfile iteration the query paths need:
//!
//! 1. Caller computes a `kept_part_ids: Vec<PartId>` via
//! the appropriate `prune_parts_for_*` for its query
//! shape.
//! 2. [`load_kept_parts`] lazy-loads each kept part via
//! `Manifest::part(id).await`, in parallel. Already-
//! loaded parts (eager mode, or warm OnceCells) cost
//! nothing.
//! 3. [`flatten_superfiles`] concatenates the loaded parts'
//! superfiles into a single `Vec<Arc<SuperfileEntry>>`
//! that the existing superfile-level skip + fan-out
//! code consumes.
//!
//! `async` end-to-end: the query paths that call these helpers
//! are themselves async and run on the owning tokio runtime, so
//! part-load GETs are driven by that runtime's reactor (no sync
//! bridge, no throwaway runtime).
use Arc;
use crate;
/// Lazy-load each part in `kept_part_ids` via
/// `ManifestSnapshot::part(id).await`, in parallel.
///
/// Cheap when parts are already loaded (eager mode, or a
/// prior query warmed them) — each `ManifestSnapshot::part` call
/// hits the part's `OnceCell` and returns an `Arc::clone`
/// without I/O. Lazy mode triggers one storage GET per
/// not-yet-loaded part; the `join_all` issues them in
/// parallel so wall-clock is `max(per-part GET latency)`
/// not the serial sum.
///
/// `await`s each part load on the caller's runtime; cold lazy
/// parts' GETs run on that runtime's reactor.
pub async
/// Concatenate the loaded parts' superfiles into a flat
/// `Vec<Arc<SuperfileEntry>>` for downstream superfile-level
/// skip + fan-out. Cheap: every entry is `Arc::clone` of an
/// already-allocated `SuperfileEntry`.
/// Combined helper: lazy-load + flatten in one call. The
/// common shape across query paths.
pub async
/// **Fallback shape** for query callers operating on
/// in-process manifests with no `list` (in-memory-only
/// supertables, or supertables that haven't persisted yet): just return
/// the flat `manifest.superfiles`. The eager-mode + lazy-mode hierarchical
/// path through `load_and_flatten` requires a persisted Manifest; this branch
/// covers the no-list case so the query paths remain uniformly callable.