Skip to content

Commit

Permalink
propagate API changes everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Nov 30, 2023
1 parent 71074f9 commit 2058394
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 31 deletions.
19 changes: 9 additions & 10 deletions crates/re_arrow_store/src/store_gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl DataStore {
table.try_drop_row(&self.cluster_cell_cache, row_id, time.as_i64());
if let Some(inner) = diff.as_mut() {
if let Some(removed) = removed {
diff = inner.union(&removed);
inner.times.extend(removed.times);
}
} else {
diff = removed;
Expand All @@ -258,7 +258,7 @@ impl DataStore {
table.try_drop_row(&self.cluster_cell_cache, row_id);
if let Some(inner) = diff.as_mut() {
if let Some(removed) = removed {
diff = inner.union(&removed);
inner.times.extend(removed.times);
}
} else {
diff = removed;
Expand Down Expand Up @@ -476,7 +476,7 @@ impl DataStore {
.entry(row_id)
.or_insert_with(|| StoreDiff::deletion(row_id, entity_path.clone()));

diff.timepoint.insert(bucket.timeline, time.into());
diff.times.push((bucket.timeline, time.into()));

for column in &mut inner.columns.values_mut() {
let cell = column[i].take();
Expand Down Expand Up @@ -656,10 +656,9 @@ impl IndexedBucketInner {
if let Some(inner) = diff.as_mut() {
inner.cells.insert(cell.component_name(), cell);
} else {
diff = StoreDiff::deletion(removed_row_id, ent_path.clone())
.at_timestamp(timeline, time)
.with_cells([cell])
.into();
let mut d = StoreDiff::deletion(removed_row_id, ent_path.clone());
d.at_timestamp(timeline, time).with_cells([cell]);
diff = Some(d);
}
}
}
Expand Down Expand Up @@ -751,9 +750,9 @@ impl PersistentIndexedTable {
if let Some(inner) = diff.as_mut() {
inner.cells.insert(cell.component_name(), cell);
} else {
diff = StoreDiff::deletion(removed_row_id, ent_path.clone())
.with_cells([cell])
.into();
let mut d = StoreDiff::deletion(removed_row_id, ent_path.clone());
d.cells.insert(cell.component_name(), cell);
diff = Some(d);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/src/store_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ impl DataStore {
}
}

let diff = StoreDiff::addition(*row_id, entity_path.clone())
.at_timepoint(timepoint.clone())
let mut diff = StoreDiff::addition(*row_id, entity_path.clone());
diff.at_timepoint(timepoint.clone())
.with_cells(cells.iter().cloned());

// TODO(#4220): should we fire for auto-generated data?
Expand Down
22 changes: 11 additions & 11 deletions crates/re_data_store/src/entity_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl CompactedStoreEvents {
event.delta().unsigned_abs();
}
} else {
for (&timeline, &time) in &event.timepoint {
for &(timeline, time) in &event.times {
let per_timeline = this.timeful.entry(event.entity_path.hash()).or_default();
let per_component = per_timeline.entry(timeline).or_default();
for component_name in event.cells.keys() {
Expand Down Expand Up @@ -205,7 +205,7 @@ impl EntityTree {
let leaf = self.create_subtrees_recursively(
event.diff.entity_path.as_slice(),
0,
&event.diff.timepoint,
&event.diff.times,
event.num_components() as _,
);

Expand Down Expand Up @@ -235,7 +235,7 @@ impl EntityTree {
pending_clears = self.flat_clears.clone().into_iter().collect_vec();
Default::default()
});
per_component.add(&store_diff.timepoint, 1);
per_component.add(&store_diff.times, 1);

// Is the newly added component under the influence of previously logged `Clear`
// component?
Expand Down Expand Up @@ -343,7 +343,7 @@ impl EntityTree {
next,
is_recursive,
store_diff.row_id,
store_diff.timepoint.clone(),
store_diff.timepoint(),
));
stack.extend(next.children.values_mut().collect::<Vec<&mut Self>>());
}
Expand All @@ -352,7 +352,7 @@ impl EntityTree {
self,
is_recursive,
store_diff.row_id,
store_diff.timepoint.clone(),
store_diff.timepoint(),
));
}

Expand Down Expand Up @@ -387,7 +387,7 @@ impl EntityTree {
.entry(component_path.entity_path().clone())
.or_default();

*timepoint = store_diff.timepoint.clone().union_max(timepoint);
*timepoint = store_diff.timepoint().union_max(timepoint);
component_paths.insert(component_path.clone());
}
}
Expand Down Expand Up @@ -433,7 +433,7 @@ impl EntityTree {
for event in filtered_events.iter().filter(|e| &e.entity_path == path) {
for component_name in event.cells.keys() {
if let Some(histo) = self.time_histograms_per_component.get_mut(component_name) {
histo.remove(&event.timepoint, 1);
histo.remove(&event.timepoint(), 1);
if histo.is_empty() {
self.time_histograms_per_component.remove(component_name);
}
Expand All @@ -442,7 +442,7 @@ impl EntityTree {
}

for event in &filtered_events {
recursive_time_histogram.remove(&event.timepoint, event.num_components() as _);
recursive_time_histogram.remove(&event.timepoint(), event.num_components() as _);
}

children.retain(|_, child| {
Expand All @@ -458,10 +458,10 @@ impl EntityTree {
&mut self,
full_path: &[EntityPathPart],
depth: usize,
timepoint: &TimePoint,
times: &[(Timeline, TimeInt)],
num_components: u32,
) -> &mut Self {
self.recursive_time_histogram.add(timepoint, num_components);
self.recursive_time_histogram.add(times, num_components);

match full_path.get(depth) {
None => {
Expand All @@ -473,7 +473,7 @@ impl EntityTree {
.or_insert_with(|| {
EntityTree::new(full_path[..depth + 1].into(), self.recursive_clears.clone())
})
.create_subtrees_recursively(full_path, depth + 1, timepoint, num_components),
.create_subtrees_recursively(full_path, depth + 1, times, num_components),
}
}

Expand Down
12 changes: 6 additions & 6 deletions crates/re_data_store/src/time_histogram_per_timeline.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::BTreeMap;

use re_arrow_store::{StoreEvent, StoreSubscriber};
use re_log_types::{TimePoint, Timeline};
use re_log_types::{TimeInt, TimePoint, Timeline};

// ---

Expand Down Expand Up @@ -51,8 +51,8 @@ impl TimeHistogramPerTimeline {
self.num_timeless_messages
}

pub fn add(&mut self, timepoint: &TimePoint, n: u32) {
if timepoint.is_timeless() {
pub fn add(&mut self, times: &[(Timeline, TimeInt)], n: u32) {
if times.is_empty() {
self.num_timeless_messages = self
.num_timeless_messages
.checked_add(n as u64)
Expand All @@ -61,11 +61,11 @@ impl TimeHistogramPerTimeline {
u64::MAX
});
} else {
for (timeline, time_value) in timepoint.iter() {
for &(timeline, time) in times {
self.times
.entry(*timeline)
.entry(timeline)
.or_default()
.increment(time_value.as_i64(), n);
.increment(time.as_i64(), n);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/re_data_store/src/times_per_timeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl StoreSubscriber for TimesPerTimeline {
re_tracing::profile_function!(format!("num_events={}", events.len()));

for event in events {
for (&timeline, &time) in &event.timepoint {
for &(timeline, time) in &event.times {
let per_time = self.0.entry(timeline).or_default();
let count = per_time.entry(time).or_default();

Expand Down
2 changes: 1 addition & 1 deletion examples/rust/custom_store_subscriber/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl StoreSubscriber for TimeRangesPerEntity {

fn on_events(&mut self, events: &[StoreEvent]) {
for event in events {
for (&timeline, &time) in &event.timepoint {
for &(timeline, time) in &event.times {
// update counters
let per_timeline = self.times.entry(event.entity_path.clone()).or_default();
let per_time = per_timeline.entry(timeline).or_default();
Expand Down

0 comments on commit 2058394

Please sign in to comment.