Skip to content

Commit a6d2c1f

Browse files
committed
Replace TimesPerTimeline with TimeHistogramPerTimeline for time-stepping (#7084)
Changes: - Added next_key_after() and prev_key_before() methods to Int64Histogram to support time-stepping functionality - Updated TimeControl and related UI components to use TimeHistogramPerTimeline - Updated EntityDb to remove times_per_timeline - Added tests for new histogram methods and time-stepping
1 parent d0d5148 commit a6d2c1f

File tree

10 files changed

+503
-393
lines changed

10 files changed

+503
-393
lines changed

crates/store/re_entity_db/src/entity_db.rs

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use re_query::{
2121
};
2222
use re_smart_channel::SmartChannelSource;
2323

24-
use crate::{Error, TimesPerTimeline, ingestion_statistics::IngestionStatistics};
24+
use crate::{Error, ingestion_statistics::IngestionStatistics};
2525

2626
// ----------------------------------------------------------------------------
2727

@@ -86,17 +86,9 @@ pub struct EntityDb {
8686
/// In many places we just store the hashes, so we need a way to translate back.
8787
entity_path_from_hash: IntMap<EntityPathHash, EntityPath>,
8888

89-
/// The global-scope time tracker.
90-
///
91-
/// For each timeline, keeps track of what times exist, recursively across all
92-
/// entities/components.
93-
///
94-
/// Used for time control.
95-
///
96-
/// TODO(#7084): Get rid of [`TimesPerTimeline`] and implement time-stepping with [`crate::TimeHistogram`] instead.
97-
times_per_timeline: TimesPerTimeline,
98-
9989
/// A time histogram of all entities, for every timeline.
90+
///
91+
/// Used for time control and gap detection.
10092
time_histogram_per_timeline: crate::TimeHistogramPerTimeline,
10193

10294
/// A tree-view (split on path components) of the entities.
@@ -146,7 +138,6 @@ impl EntityDb {
146138
last_modified_at: web_time::Instant::now(),
147139
latest_row_id: None,
148140
entity_path_from_hash: Default::default(),
149-
times_per_timeline: Default::default(),
150141
tree: crate::EntityTree::root(),
151142
time_histogram_per_timeline: Default::default(),
152143
storage_engine,
@@ -460,9 +451,6 @@ impl EntityDb {
460451
self.storage_engine().store().timelines()
461452
}
462453

463-
pub fn times_per_timeline(&self) -> &TimesPerTimeline {
464-
&self.times_per_timeline
465-
}
466454

467455
pub fn has_any_data_on_timeline(&self, timeline: &TimelineName) -> bool {
468456
self.time_histogram_per_timeline
@@ -483,6 +471,11 @@ impl EntityDb {
483471
self.time_histogram_per_timeline.get(timeline)
484472
}
485473

474+
/// Histogram of all entities and events
475+
pub fn time_histogram_per_timeline(&self) -> &crate::TimeHistogramPerTimeline {
476+
&self.time_histogram_per_timeline
477+
}
478+
486479
#[inline]
487480
pub fn num_rows(&self) -> u64 {
488481
self.storage_engine.read().store().stats().total().num_rows
@@ -600,7 +593,6 @@ impl EntityDb {
600593

601594
{
602595
// Update our internal views by notifying them of resulting [`ChunkStoreEvent`]s.
603-
self.times_per_timeline.on_events(&store_events);
604596
self.time_histogram_per_timeline.on_events(&store_events);
605597
self.tree.on_store_additions(&store_events);
606598

@@ -675,7 +667,6 @@ impl EntityDb {
675667
);
676668

677669
Self::on_store_deletions(
678-
&mut self.times_per_timeline,
679670
&mut self.time_histogram_per_timeline,
680671
&mut self.tree,
681672
engine,
@@ -699,7 +690,6 @@ impl EntityDb {
699690

700691
let store_events = engine.store().drop_time_range(timeline, drop_range);
701692
Self::on_store_deletions(
702-
&mut self.times_per_timeline,
703693
&mut self.time_histogram_per_timeline,
704694
&mut self.tree,
705695
engine,
@@ -721,7 +711,6 @@ impl EntityDb {
721711

722712
let store_events = engine.store().drop_entity_path(entity_path);
723713
Self::on_store_deletions(
724-
&mut self.times_per_timeline,
725714
&mut self.time_histogram_per_timeline,
726715
&mut self.tree,
727716
engine,
@@ -749,14 +738,12 @@ impl EntityDb {
749738
// NOTE: Parameters deconstructed instead of taking `self`, because borrowck cannot understand
750739
// partial borrows on methods.
751740
fn on_store_deletions(
752-
times_per_timeline: &mut TimesPerTimeline,
753741
time_histogram_per_timeline: &mut crate::TimeHistogramPerTimeline,
754742
tree: &mut crate::EntityTree,
755743
mut engine: StorageEngineWriteGuard<'_>,
756744
store_events: &[ChunkStoreEvent],
757745
) {
758746
engine.cache().on_events(store_events);
759-
times_per_timeline.on_events(store_events);
760747
time_histogram_per_timeline.on_events(store_events);
761748

762749
let engine = engine.downgrade();

crates/store/re_entity_db/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ mod ingestion_statistics;
1010
mod instance_path;
1111
mod store_bundle;
1212
mod time_histogram_per_timeline;
13-
mod times_per_timeline;
1413
mod versioned_instance_path;
1514

1615
pub use self::{
@@ -20,7 +19,6 @@ pub use self::{
2019
instance_path::{InstancePath, InstancePathHash},
2120
store_bundle::{StoreBundle, StoreLoadError},
2221
time_histogram_per_timeline::{TimeHistogram, TimeHistogramPerTimeline},
23-
times_per_timeline::{TimeCounts, TimelineStats, TimesPerTimeline},
2422
versioned_instance_path::{VersionedInstancePath, VersionedInstancePathHash},
2523
};
2624

crates/store/re_entity_db/src/times_per_timeline.rs

Lines changed: 0 additions & 163 deletions
This file was deleted.

0 commit comments

Comments
 (0)