Skip to content

Commit

Permalink
re_query_cache2 -> re_query_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Apr 16, 2024
1 parent fd2322a commit 6634872
Show file tree
Hide file tree
Showing 95 changed files with 113 additions and 114 deletions.
14 changes: 7 additions & 7 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 @@ -45,7 +45,7 @@ re_log_encoding = { path = "crates/re_log_encoding", version = "=0.16.0-alpha.1"
re_log_types = { path = "crates/re_log_types", version = "=0.16.0-alpha.1", default-features = false }
re_memory = { path = "crates/re_memory", version = "=0.16.0-alpha.1", default-features = false }
re_query = { path = "crates/re_query", version = "=0.16.0-alpha.1", default-features = false }
re_query_cache2 = { path = "crates/re_query_cache2", version = "=0.16.0-alpha.1", default-features = false }
re_query_cache = { path = "crates/re_query_cache", version = "=0.16.0-alpha.1", default-features = false }
re_query2 = { path = "crates/re_query2", version = "=0.16.0-alpha.1", default-features = false }
re_renderer = { path = "crates/re_renderer", version = "=0.16.0-alpha.1", default-features = false }
re_sdk = { path = "crates/re_sdk", version = "=0.16.0-alpha.1", 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 @@ -75,7 +75,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
2 changes: 1 addition & 1 deletion crates/re_entity_db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ re_log_encoding = { workspace = true, features = ["decoder"] }
re_log_types.workspace = true
re_query.workspace = true
re_query2.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
40 changes: 20 additions & 20 deletions crates/re_entity_db/src/entity_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub struct EntityDb {
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 @@ -132,7 +132,7 @@ impl EntityDb {
InstanceKey::name(),
DataStoreConfig::default(),
);
let query_caches2 = re_query_cache2::Caches::new(&data_store);
let query_caches = re_query_cache::Caches::new(&data_store);
Self {
data_source: None,
set_store_info: None,
Expand All @@ -143,7 +143,7 @@ impl EntityDb {
tree: crate::EntityTree::root(),
data_store,
resolver: re_query2::PromiseResolver::default(),
query_caches2,
query_caches,
stats: IngestionStatistics::new(store_id),
}
}
Expand Down Expand Up @@ -192,8 +192,8 @@ impl EntityDb {
}

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

#[inline]
Expand All @@ -209,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().cloned(), // 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 @@ -238,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 @@ -252,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 @@ -266,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 @@ -453,7 +453,7 @@ impl EntityDb {
// and/or pending clears.
let original_store_events = &[store_event];
self.times_per_timeline.on_events(original_store_events);
self.query_caches2.on_events(original_store_events);
self.query_caches.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 @@ -462,7 +462,7 @@ impl EntityDb {
// notified of, again!
let new_store_events = self.on_clear_cascade(clear_cascade);
self.times_per_timeline.on_events(&new_store_events);
self.query_caches2.on_events(&new_store_events);
self.query_caches.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 @@ -619,12 +619,12 @@ impl EntityDb {
tree,
data_store: _,
resolver: _,
query_caches2,
query_caches,
stats: _,
} = self;

times_per_timeline.on_events(store_events);
query_caches2.on_events(store_events);
query_caches.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use re_log_types::{
DataRow, EntityPath, RowId, TimePoint,
};
use re_query2::PromiseResolver;
use re_query_cache2::Caches;
use re_query_cache::Caches;
use re_types::Archetype as _;
use re_types_core::{components::InstanceKey, Loggable as _};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use re_log_types::{
example_components::{MyColor, MyPoint, MyPoints},
DataRow, EntityPath, RowId, TimePoint,
};
use re_query_cache2::{Caches, PromiseResolver, PromiseResult};
use re_query_cache::{Caches, PromiseResolver, PromiseResult};
use re_types::{components::InstanceKey, Archetype};
use re_types_core::Loggable as _;

Expand Down
2 changes: 1 addition & 1 deletion crates/re_space_view/src/sub_archetypes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use re_data_store::LatestAtQuery;
use re_entity_db::{
external::re_query_cache2::{CachedLatestAtResults, PromiseResult, ToArchetype},
external::re_query_cache::{CachedLatestAtResults, PromiseResult, ToArchetype},
EntityDb,
};
use re_log_types::EntityPath;
Expand Down
Loading

0 comments on commit 6634872

Please sign in to comment.