|
1 | 1 | use std::sync::Arc;
|
2 | 2 |
|
3 |
| -use itertools::Itertools; |
4 | 3 | use nohash_hasher::IntMap;
|
5 | 4 | use parking_lot::Mutex;
|
6 | 5 |
|
@@ -71,7 +70,11 @@ pub struct EntityDb {
|
71 | 70 |
|
72 | 71 | impl EntityDb {
|
73 | 72 | pub fn new(store_id: StoreId) -> Self {
|
74 |
| - let data_store = ChunkStore::new(store_id.clone(), ChunkStoreConfig::default()); |
| 73 | + Self::with_store_config(store_id, ChunkStoreConfig::from_env().unwrap_or_default()) |
| 74 | + } |
| 75 | + |
| 76 | + pub fn with_store_config(store_id: StoreId, store_config: ChunkStoreConfig) -> Self { |
| 77 | + let data_store = ChunkStore::new(store_id.clone(), store_config); |
75 | 78 | let query_caches = re_query::Caches::new(&data_store);
|
76 | 79 |
|
77 | 80 | Self {
|
@@ -347,23 +350,23 @@ impl EntityDb {
|
347 | 350 | }
|
348 | 351 |
|
349 | 352 | pub fn add_chunk(&mut self, chunk: &Arc<Chunk>) -> Result<(), Error> {
|
350 |
| - let store_event = self.data_store.insert_chunk(chunk)?; |
| 353 | + let store_events = self.data_store.insert_chunk(chunk)?; |
351 | 354 |
|
352 | 355 | self.register_entity_path(chunk.entity_path());
|
353 | 356 |
|
354 | 357 | if self.latest_row_id < chunk.row_id_range().map(|(_, row_id_max)| row_id_max) {
|
355 | 358 | self.latest_row_id = chunk.row_id_range().map(|(_, row_id_max)| row_id_max);
|
356 | 359 | }
|
357 | 360 |
|
358 |
| - if let Some(store_event) = store_event { |
| 361 | + { |
359 | 362 | // Update our internal views by notifying them of resulting [`ChunkStoreEvent`]s.
|
360 |
| - let original_store_events = &[store_event]; |
361 |
| - self.times_per_timeline.on_events(original_store_events); |
362 |
| - self.query_caches.on_events(original_store_events); |
363 |
| - self.tree.on_store_additions(original_store_events); |
| 363 | + self.times_per_timeline.on_events(&store_events); |
| 364 | + self.query_caches.on_events(&store_events); |
| 365 | + self.tree.on_store_additions(&store_events); |
| 366 | + self.tree.on_store_deletions(&store_events); |
364 | 367 |
|
365 | 368 | // We inform the stats last, since it measures e2e latency.
|
366 |
| - self.stats.on_events(original_store_events); |
| 369 | + self.stats.on_events(&store_events); |
367 | 370 | }
|
368 | 371 |
|
369 | 372 | Ok(())
|
@@ -435,8 +438,7 @@ impl EntityDb {
|
435 | 438 | times_per_timeline.on_events(store_events);
|
436 | 439 | query_caches.on_events(store_events);
|
437 | 440 |
|
438 |
| - let store_events = store_events.iter().collect_vec(); |
439 |
| - tree.on_store_deletions(&store_events); |
| 441 | + tree.on_store_deletions(store_events); |
440 | 442 | }
|
441 | 443 |
|
442 | 444 | /// Key used for sorting recordings in the UI.
|
|
0 commit comments