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>)
| 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. |
| 302 | fn 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`. |
no test coverage detected