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

Function parse_export

src/clusterd-test-driver/src/text.rs:302–327  ·  view source on GitHub ↗

Parse an `export` sub-command into an [`ExportSpec`]. The `kind=` argument selects the variant (defaulting to `index`); each kind takes its own arguments.

(args: &BTreeMap<String, String>)

Source from the content-addressed store, hash-verified

300/// Parse an `export` sub-command into an [`ExportSpec`]. The `kind=` argument
301/// selects the variant (defaulting to `index`); each kind takes its own arguments.
302fn parse_export(args: &BTreeMap<String, String>) -> anyhow::Result<ExportSpec> {
303 let on_id = req_u64(args, "on")?;
304 Ok(
305 match args.get("kind").map(String::as_str).unwrap_or("index") {
306 "index" => ExportSpec::Index {
307 index_id: req_u64(args, "index")?,
308 on_id,
309 key: parse_usize_list(req(args, "key")?)?,
310 },
311 "materialized-view" => ExportSpec::MaterializedView {
312 sink_id: req_u64(args, "sink")?,
313 on_id,
314 shard: req(args, "shard")?.to_string(),
315 schema: opt_string(args, "schema"),
316 },
317 "subscribe" => ExportSpec::Subscribe {
318 sink_id: req_u64(args, "sink")?,
319 on_id,
320 schema: opt_string(args, "schema"),
321 up_to: opt_u64(args, "up-to")?,
322 },
323 "copy-to" => bail!("copy-to export is not implemented"),
324 other => bail!("unknown export kind `{other}`"),
325 },
326 )
327}
328
329/// Parse body lines as rows of raw space-separated value tokens (quotes intact).
330/// The tokens are typed against the schema server-side; see `cell_from_token`.

Callers 1

parse_create_dataflowFunction · 0.85

Calls 8

req_u64Function · 0.85
parse_usize_listFunction · 0.85
opt_stringFunction · 0.85
opt_u64Function · 0.85
reqFunction · 0.70
mapMethod · 0.45
getMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected