Build a single-index dataflow over a persist shard. Thin sugar over [`DataflowBuilder`] for the common shape: import the collection backed by `shard` as `source_id`, set `as_of`, and export an index `index_id` arranging the collection by `key_cols`. `shard_upper` is the exclusive upper bound of the shard's written data; see [`PersistSource::upper`].
(
source_id: GlobalId,
index_id: GlobalId,
shard: ShardId,
location: PersistLocation,
desc: RelationDesc,
key_cols: Vec<usize>,
as_of: Timestamp,
shard_upper: Timestamp
| 455 | /// `shard_upper` is the exclusive upper bound of the shard's written data; see |
| 456 | /// [`PersistSource::upper`]. |
| 457 | pub fn index_dataflow( |
| 458 | source_id: GlobalId, |
| 459 | index_id: GlobalId, |
| 460 | shard: ShardId, |
| 461 | location: PersistLocation, |
| 462 | desc: RelationDesc, |
| 463 | key_cols: Vec<usize>, |
| 464 | as_of: Timestamp, |
| 465 | shard_upper: Timestamp, |
| 466 | ) -> anyhow::Result<DataflowDescription<RenderPlan, CollectionMetadata>> { |
| 467 | let mut builder = DataflowBuilder::new("headless-index"); |
| 468 | builder.import_persist( |
| 469 | source_id, |
| 470 | PersistSource { |
| 471 | shard, |
| 472 | location, |
| 473 | desc, |
| 474 | upper: shard_upper, |
| 475 | }, |
| 476 | ); |
| 477 | builder.as_of(as_of); |
| 478 | builder.export_index(index_id, source_id, key_cols); |
| 479 | builder.finish() |
| 480 | } |
| 481 | |
| 482 | /// Build a dataflow that counts the rows of an existing index and exports the |
| 483 | /// count as a new, peekable index. |