| 2386 | Vec<(SpanProjectionId, Vec<SpanProjectionId>)>, |
| 2387 | ); |
| 2388 | fn projection_ids( |
| 2389 | repo: &Pristine, |
| 2390 | store: &MemoryChangeStore, |
| 2391 | view_name: &str, |
| 2392 | inode: Inode, |
| 2393 | ) -> Result<ProjectionIds> { |
| 2394 | let txn = repo.read_txn()?; |
| 2395 | let view = txn.get_view(view_name)?.context("view missing")?; |
| 2396 | let visible = EffectiveProjectionClosure::try_from_membership( |
| 2397 | &txn, |
| 2398 | &txn.view_membership_set(&view)?, |
| 2399 | )?; |
| 2400 | let state = SpanRenderContext::new(&txn, store, &visible)? |
| 2401 | .record_state(inode)? |
| 2402 | .context("span state missing")?; |
| 2403 | let snapshot = state.semantic_snapshot()?; |
| 2404 | Ok(( |
| 2405 | snapshot.id, |
| 2406 | snapshot |
| 2407 | .lines |
| 2408 | .into_iter() |
| 2409 | .map(|line| { |
| 2410 | ( |
| 2411 | line.id, |
| 2412 | line.tokens.into_iter().map(|token| token.id).collect(), |
| 2413 | ) |
| 2414 | }) |
| 2415 | .collect(), |
| 2416 | )) |
| 2417 | } |
| 2418 | let dir = tempfile::tempdir()?; |
| 2419 | let path = dir.path().join("pristine.redb"); |
| 2420 | let repo = Pristine::open(&path)?; |