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
//! The flush: applies the refresh work a transaction queued (`crate::queue`) to
//! the TVIEWs, dependencies first, following each refreshed row to the TVIEWs
//! that embed it (ADR 0203).
//!
//! - [`drain`]: the loop that takes the queue and refreshes one entity at a time
//! in dependency order until nothing is left;
//! - [`apply`]: how one entity's keys are applied (full refresh, direct patch,
//! recompute, fan-out) and their parents found;
//! - [`graph`]: the TVIEWs' dependencies on each other, from their plans;
//! - [`xact`]: the transaction callbacks, and what the end of a transaction resets.
pub use EntityDepGraph;
pub use ;
use crateTViewResult;
/// Flush the refresh queue: process all pending TVIEW refreshes.
///
/// Called after each statement (the flush trigger), by the `ProcessUtility` hook
/// before COMMIT and PREPARE TRANSACTION, and by the functions that must see
/// fresh TVIEWs. SPI must be available, so never from a transaction callback.
///
/// # Correctness
///
/// - Each (entity, key) is refreshed at most once per flush.
/// - An entity is refreshed after every TVIEW it reads: the next entity is the
/// first pending one in topological order, and propagation only adds entities
/// after it.
/// - The first error aborts the transaction.
///
/// # Errors
/// What a refresh, a catalog read or a propagation query returns, and
/// [`crate::TViewError::DepthExceeded`] when propagation does not settle.
thread_local!
/// While alive, a flush is running in this backend. Dropped when the flush
/// returns or unwinds; the transaction's end clears it too.
;