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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//! THE BINDING: async-graphql's `DataLoader` as one provider of [`Batched`], reached from
//! [`AsyncBatchLoad`].
//!
//! ```text
//! AsyncBatchLoad<K> ← ingraph's seam: these keys, in one ask
//! │ AsLoader
//! ▼
//! dataloader::Loader<K> ← async-graphql's: the window, the dedup, the fan-out
//! │ DataLoader::new(…, spawner)
//! ▼
//! Batched<K, V> ← ingraph's again: one key, answered
//! │
//! ▼
//! BatchDoor<K, V> ← what the emitted resolver looks up
//! ```
//!
//! # A BINDING, and under a feature of its own
//!
//! *独立 opt-in feature — the dataloader dependency rides its own feature, costing nobody who does
//! not ask.* The ruling named five crates — `futures-channel`, `lru`, and `lru`'s `hashbrown`,
//! `foldhash` and `allocator-api2`. Measured in THIS graph the net add is two: the other three are
//! already here through other edges. Either number is a cost a build serving one root field per
//! document never uses, so the `dataloader` feature is independent of `async-graphql` — a schema
//! builds, every emitted resolver keeps its two lanes, and none of them is compiled. The
//! measurement and the `cargo tree` that took it are written out at the feature's own row in
//! `Cargo.toml`.
//!
//! It is a BINDING and not the seam for the reason the module note states: the engine below is
//! adopted whole — this file builds no window, no dedup and no fan-out — and the seam above names
//! no wire backend, so a second one binds the same [`AsyncBatchLoad`] without touching it.
//!
//! # The SPAWNER never appears here
//!
//! `DataLoader::new` takes one, and this file hands it straight through. Choosing a runtime is an
//! application's act: `ingraph` enables no `runtime-*` feature of sqlx for the same reason, and a
//! framework that spawned on a runtime of its own choosing would be making that choice for every
//! consumer at once.
use ;
use ;
use ;
/// Any [`AsyncBatchLoad`] as one of async-graphql's `Loader`s.
///
/// A TRANSPARENT wrapper — the `pub` field IS the contract, the [`Reverse`](core::cmp::Reverse)
/// shape — so a mint site reads `AsLoader(SqlRows::new(door))` and nothing has to be looked up to
/// know what is inside.
///
/// # Every engine bound is carried HERE
///
/// [`AsyncBatchLoad`] bounds its key by nothing, because a batch read needs nothing of it. What the
/// COALESCING engine needs is another matter — a key it can hash and compare to dedup, and clone to
/// fan an answer back out — and those are stated at this impl, which is the position that spends
/// them. That placement is what keeps a third-party loader over an un-hashable key legal at the
/// seam while this binding refuses it, at the binding, with the bound named.
;
/// The engine as a door's provider — the second half of the binding.
///
/// Generic over the CACHE FACTORY rather than fixed at `NoCache`, so an application that wants a
/// request-scoped `LruCache` installs one and the door does not care. `load_one`'s own impl block
/// is bounded that way and this one follows it.