Skip to content

Commit

Permalink
propagate changes
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Apr 25, 2024
1 parent d075f51 commit 5313a5b
Show file tree
Hide file tree
Showing 95 changed files with 105 additions and 146 deletions.
32 changes: 0 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ re_log_encoding = { path = "crates/re_log_encoding", version = "=0.16.0-alpha.2"
re_log_types = { path = "crates/re_log_types", version = "=0.16.0-alpha.2", default-features = false }
re_memory = { path = "crates/re_memory", version = "=0.16.0-alpha.2", default-features = false }
re_query = { path = "crates/re_query", version = "=0.16.0-alpha.2", default-features = false }
re_query_cache2 = { path = "crates/re_query_cache2", version = "=0.16.0-alpha.2", default-features = false }
re_query_cache = { path = "crates/re_query_cache", version = "=0.16.0-alpha.2", default-features = false }
re_query2 = { path = "crates/re_query2", version = "=0.16.0-alpha.2", default-features = false }
re_renderer = { path = "crates/re_renderer", version = "=0.16.0-alpha.2", default-features = false }
re_sdk = { path = "crates/re_sdk", version = "=0.16.0-alpha.2", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/re_data_ui/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Arc;
use egui::NumExt;

use re_entity_db::{
external::re_query_cache2::CachedLatestAtComponentResults, EntityPath, InstancePath,
external::re_query_cache::CachedLatestAtComponentResults, EntityPath, InstancePath,
};
use re_types::ComponentName;
use re_ui::SyntaxHighlighting as _;
Expand Down
2 changes: 1 addition & 1 deletion crates/re_data_ui/src/component_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl DataUi for ComponentPath {
));
} else {
let results =
db.query_caches2()
db.query_caches()
.latest_at(db.store(), query, entity_path, [*component_name]);
if let Some(results) = results.components.get(component_name) {
crate::EntityLatestAtResults {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_data_ui/src/component_ui_registry.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use re_data_store::LatestAtQuery;
use re_entity_db::{external::re_query_cache2::CachedLatestAtComponentResults, EntityDb};
use re_entity_db::{external::re_query_cache::CachedLatestAtComponentResults, EntityDb};
use re_log_types::{external::arrow2, EntityPath};
use re_types::external::arrow2::array::Utf8Array;
use re_viewer_context::{ComponentUiRegistry, UiVerbosity, ViewerContext};
Expand Down
2 changes: 1 addition & 1 deletion crates/re_data_ui/src/editors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use egui::NumExt as _;
use re_data_store::LatestAtQuery;
use re_entity_db::{external::re_query_cache2::CachedLatestAtComponentResults, EntityDb};
use re_entity_db::{external::re_query_cache::CachedLatestAtComponentResults, EntityDb};
use re_log_types::EntityPath;
use re_types::{
components::{
Expand Down
2 changes: 1 addition & 1 deletion crates/re_data_ui/src/instance_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl DataUi for InstancePath {
.num_columns(2)
.show(ui, |ui| {
for component_name in normal_components {
let results = db.query_caches2().latest_at(
let results = db.query_caches().latest_at(
db.store(),
query,
entity_path,
Expand Down
3 changes: 1 addition & 2 deletions crates/re_entity_db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ re_log_encoding = { workspace = true, features = ["decoder"] }
re_log_types.workspace = true
re_query.workspace = true
re_query2.workspace = true
re_query_cache.workspace = true
re_query_cache2 = { workspace = true, features = ["to_archetype"] }
re_query_cache = { workspace = true, features = ["to_archetype"] }
re_smart_channel.workspace = true
re_tracing.workspace = true
re_types_core.workspace = true
Expand Down
42 changes: 14 additions & 28 deletions crates/re_entity_db/src/entity_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,11 @@ pub struct EntityDb {
/// Stores all components for all entities for all timelines.
data_store: DataStore,

/// Query caches for the data in [`Self::data_store`].
query_caches: re_query_cache::Caches,

/// The active promise resolver for this DB.
resolver: re_query2::PromiseResolver,

/// Query caches for the data in [`Self::data_store`].
query_caches2: re_query_cache2::Caches,
query_caches: re_query_cache::Caches,

stats: IngestionStatistics,
}
Expand All @@ -136,7 +133,6 @@ impl EntityDb {
DataStoreConfig::default(),
);
let query_caches = re_query_cache::Caches::new(&data_store);
let query_caches2 = re_query_cache2::Caches::new(&data_store);
Self {
data_source: None,
set_store_info: None,
Expand All @@ -146,9 +142,8 @@ impl EntityDb {
times_per_timeline: Default::default(),
tree: crate::EntityTree::root(),
data_store,
query_caches,
resolver: re_query2::PromiseResolver::default(),
query_caches2,
query_caches,
stats: IngestionStatistics::new(store_id),
}
}
Expand Down Expand Up @@ -201,11 +196,6 @@ impl EntityDb {
&self.query_caches
}

#[inline]
pub fn query_caches2(&self) -> &re_query_cache2::Caches {
&self.query_caches2
}

#[inline]
pub fn resolver(&self) -> &re_query2::PromiseResolver {
&self.resolver
Expand All @@ -219,21 +209,21 @@ impl EntityDb {
query: &re_data_store::LatestAtQuery,
) -> PromiseResult<Option<A>>
where
re_query_cache2::CachedLatestAtResults: re_query_cache2::ToArchetype<A>,
re_query_cache::CachedLatestAtResults: re_query_cache::ToArchetype<A>,
{
let results = self.query_caches2().latest_at(
let results = self.query_caches().latest_at(
self.store(),
query,
entity_path,
A::all_components().iter().copied(), // no generics!
);

use re_query_cache2::ToArchetype as _;
use re_query_cache::ToArchetype as _;
match results.to_archetype(self.resolver()).flatten() {
PromiseResult::Pending => PromiseResult::Pending,
PromiseResult::Error(err) => {
if let Some(err) = err.downcast_ref::<re_query_cache2::QueryError>() {
if matches!(err, re_query_cache2::QueryError::PrimaryNotFound(_)) {
if let Some(err) = err.downcast_ref::<re_query_cache::QueryError>() {
if matches!(err, re_query_cache::QueryError::PrimaryNotFound(_)) {
return PromiseResult::Ready(None);
}
}
Expand All @@ -248,8 +238,8 @@ impl EntityDb {
&self,
entity_path: &EntityPath,
query: &re_data_store::LatestAtQuery,
) -> Option<re_query_cache2::CachedLatestAtMonoResult<C>> {
self.query_caches2().latest_at_component::<C>(
) -> Option<re_query_cache::CachedLatestAtMonoResult<C>> {
self.query_caches().latest_at_component::<C>(
self.store(),
self.resolver(),
entity_path,
Expand All @@ -262,8 +252,8 @@ impl EntityDb {
&self,
entity_path: &EntityPath,
query: &re_data_store::LatestAtQuery,
) -> Option<re_query_cache2::CachedLatestAtMonoResult<C>> {
self.query_caches2().latest_at_component_quiet::<C>(
) -> Option<re_query_cache::CachedLatestAtMonoResult<C>> {
self.query_caches().latest_at_component_quiet::<C>(
self.store(),
self.resolver(),
entity_path,
Expand All @@ -276,8 +266,8 @@ impl EntityDb {
&self,
entity_path: &EntityPath,
query: &re_data_store::LatestAtQuery,
) -> Option<(EntityPath, re_query_cache2::CachedLatestAtMonoResult<C>)> {
self.query_caches2()
) -> Option<(EntityPath, re_query_cache::CachedLatestAtMonoResult<C>)> {
self.query_caches()
.latest_at_component_at_closest_ancestor::<C>(
self.store(),
self.resolver(),
Expand Down Expand Up @@ -477,7 +467,6 @@ impl EntityDb {
let original_store_events = &[store_event];
self.times_per_timeline.on_events(original_store_events);
self.query_caches.on_events(original_store_events);
self.query_caches2.on_events(original_store_events);
let clear_cascade = self.tree.on_store_additions(original_store_events);

// Second-pass: update the [`DataStore`] by applying the [`ClearCascade`].
Expand All @@ -487,7 +476,6 @@ impl EntityDb {
let new_store_events = self.on_clear_cascade(clear_cascade);
self.times_per_timeline.on_events(&new_store_events);
self.query_caches.on_events(&new_store_events);
self.query_caches2.on_events(&new_store_events);
let clear_cascade = self.tree.on_store_additions(&new_store_events);

// Clears don't affect `Clear` components themselves, therefore we cannot have recursive
Expand Down Expand Up @@ -643,15 +631,13 @@ impl EntityDb {
times_per_timeline,
tree,
data_store: _,
query_caches,
resolver: _,
query_caches2,
query_caches,
stats: _,
} = self;

times_per_timeline.on_events(store_events);
query_caches.on_events(store_events);
query_caches2.on_events(store_events);

let store_events = store_events.iter().collect_vec();
let compacted = CompactedStoreEvents::new(&store_events);
Expand Down
2 changes: 1 addition & 1 deletion crates/re_entity_db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub use editable_auto_value::EditableAutoValue;
pub mod external {
pub use re_data_store;
pub use re_query2;
pub use re_query_cache2;
pub use re_query_cache;
}

// ----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
[package]
name = "re_query_cache2"
name = "re_query_cache"
authors.workspace = true
description = "Temporary crate meant to replace re_query_cache"
edition.workspace = true
homepage.workspace = true
include.workspace = true
license.workspace = true
# TODO(cmc): Replace re_query with this crate. Never publish this one.
publish = false
publish = true
readme = "README.md"
repository.workspace = true
rust-version.workspace = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# re_query_cache2
# re_query_cache

Temporary crate for implementing the new cached data APIs. Not published.

Will replace `re_query_cache2` when ready.
Will replace `re_query_cache` when ready.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use criterion::{criterion_group, criterion_main, Criterion};

use itertools::Itertools as _;

use re_query_cache2::FlatVecDeque;
use re_query_cache::FlatVecDeque;

// ---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use itertools::Itertools;
use re_data_store::{DataStore, LatestAtQuery, StoreSubscriber};
use re_log_types::{entity_path, DataRow, EntityPath, RowId, TimeInt, TimeType, Timeline};
use re_query2::{clamped_zip_1x1, PromiseResolver};
use re_query_cache2::{CachedLatestAtResults, Caches};
use re_query_cache::{CachedLatestAtResults, Caches};
use re_types::{
archetypes::Points2D,
components::{Color, InstanceKey, Position2D, Text},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use re_log_types::example_components::{MyColor, MyLabel, MyPoint, MyPoints};
use re_log_types::{build_frame_nr, DataRow, RowId, TimeType, Timeline};
use re_types_core::{Archetype as _, Loggable as _};

use re_query_cache2::{
use re_query_cache::{
clamped_zip_1x2, CachedLatestAtComponentResults, CachedLatestAtResults, PromiseResolver,
PromiseResult,
};
Expand All @@ -22,7 +22,7 @@ fn main() -> anyhow::Result<()> {
let query = LatestAtQuery::latest(timeline);
eprintln!("query:{query:?}");

let caches = re_query_cache2::Caches::new(&store);
let caches = re_query_cache::Caches::new(&store);

// First, get the results for this query.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use re_types::{
};
use re_types_core::{Archetype as _, Loggable as _};

use re_query_cache2::{clamped_zip_1x2, CachedLatestAtResults, PromiseResolver, PromiseResult};
use re_query_cache::{clamped_zip_1x2, CachedLatestAtResults, PromiseResolver, PromiseResult};

// ---

Expand All @@ -22,7 +22,7 @@ fn main() -> anyhow::Result<()> {
let query = LatestAtQuery::latest(timeline);
eprintln!("query:{query:?}");

let caches = re_query_cache2::Caches::new(&store);
let caches = re_query_cache::Caches::new(&store);

// First, get the results for this query.
//
Expand All @@ -37,7 +37,7 @@ fn main() -> anyhow::Result<()> {

// Then make use of the `ToArchetype` helper trait in order to query, resolve, deserialize and
// cache an entire archetype all at once.
use re_query_cache2::ToArchetype as _;
use re_query_cache::ToArchetype as _;

let arch: Points2D = match results.to_archetype(&resolver).flatten() {
PromiseResult::Pending => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use re_log_types::example_components::{MyColor, MyLabel, MyPoint, MyPoints};
use re_log_types::{build_frame_nr, DataRow, RowId, TimeRange, TimeType, Timeline};
use re_types_core::{Archetype as _, Loggable as _};

use re_query_cache2::{
use re_query_cache::{
clamped_zip_1x2, range_zip_1x2, CachedRangeComponentResults, CachedRangeResults,
PromiseResolver, PromiseResult,
};
Expand All @@ -22,7 +22,7 @@ fn main() -> anyhow::Result<()> {
let query = RangeQuery::new(timeline, TimeRange::EVERYTHING);
eprintln!("query:{query:?}");

let caches = re_query_cache2::Caches::new(&store);
let caches = re_query_cache::Caches::new(&store);

// First, get the raw results for this query.
//
Expand Down
Loading

0 comments on commit 5313a5b

Please sign in to comment.