MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / render

Method render

src/storage/src/source/postgres.rs:126–268  ·  view source on GitHub ↗

Render the ingestion dataflow. This function only connects things together and contains no actual processing logic.

(
        self,
        scope: Scope<'scope, MzOffset>,
        config: &RawSourceCreationConfig,
        resume_uppers: impl futures::Stream<Item = Antichain<MzOffset>> + 'static,
        _start_sign

Source from the content-addressed store, hash-verified

124 /// Render the ingestion dataflow. This function only connects things together and contains no
125 /// actual processing logic.
126 fn render<'scope>(
127 self,
128 scope: Scope<'scope, MzOffset>,
129 config: &RawSourceCreationConfig,
130 resume_uppers: impl futures::Stream<Item = Antichain<MzOffset>> + 'static,
131 _start_signal: impl std::future::Future<Output = ()> + 'static,
132 ) -> (
133 BTreeMap<
134 GlobalId,
135 StackedCollection<'scope, MzOffset, Result<SourceMessage, DataflowError>>,
136 >,
137 StreamVec<'scope, MzOffset, HealthStatusMessage>,
138 StreamVec<'scope, MzOffset, Probe<MzOffset>>,
139 Vec<PressOnDropButton>,
140 ) {
141 // Collect the source outputs that we will be exporting into a per-table map.
142 let mut table_info = BTreeMap::new();
143 for (idx, (id, export)) in config.source_exports.iter().enumerate() {
144 let SourceExport {
145 details,
146 storage_metadata: _,
147 data_config: _,
148 } = export;
149 let details = match details {
150 SourceExportDetails::Postgres(details) => details,
151 // This is an export that doesn't need any data output to it.
152 SourceExportDetails::None => continue,
153 _ => panic!("unexpected source export details: {:?}", details),
154 };
155 let desc = details.table.clone();
156 let casts = details.column_casts.clone();
157 let resume_upper = Antichain::from_iter(
158 config
159 .source_resume_uppers
160 .get(id)
161 .expect("all source exports must be present in source resume uppers")
162 .iter()
163 .map(MzOffset::decode_row),
164 );
165 let output = SourceOutputInfo {
166 desc,
167 projection: None,
168 casts,
169 resume_upper,
170 export_id: id.clone(),
171 };
172 table_info
173 .entry(output.desc.oid)
174 .or_insert_with(BTreeMap::new)
175 .insert(idx, output);
176 }
177
178 let metrics = config.metrics.get_postgres_source_metrics(config.id);
179
180 let (snapshot_updates, rewinds, slot_ready, snapshot_err, snapshot_token) =
181 snapshot::render(
182 scope.clone(),
183 config.clone(),

Callers

nothing calls this directly

Calls 15

enumerateMethod · 0.80
expectMethod · 0.80
as_collectionMethod · 0.80
display_with_causesMethod · 0.80
renderFunction · 0.50
iterMethod · 0.45
cloneMethod · 0.45
mapMethod · 0.45
getMethod · 0.45
insertMethod · 0.45
entryMethod · 0.45

Tested by

no test coverage detected