Skip to content

Commit

Permalink
New data APIs 15: one query crate to rule them all (#6036)
Browse files Browse the repository at this point in the history
There is now only one way to query data: `re_query` (well you can still
query the datastore directly if you're a monster, but that's for another
PR).

All queries go through both the query cache and the deserialization
cache.
There will be a follow-up PR to disable the deserialization cache for
specific components.

Most of this is just (re)moving stuff around except for the last two
commits which take care of porting the cached test suites since they
cannot depend on uncached APIs to do comparisons anymore.

- Closes #6018 
- Closes #3320

---

Part of a PR series to completely revamp the data APIs in preparation
for the removal of instance keys and the introduction of promises:
- #5573
- #5574
- #5581
- #5605
- #5606
- #5633
- #5673
- #5679
- #5687
- #5755
- #5990
- #5992
- #5993 
- #5994
- #6035
- #6036
- #6037

Builds on top of the static data PR series:
- #5534
  • Loading branch information
teh-cmc authored Apr 26, 2024
1 parent e58bc19 commit 8fe76ad
Show file tree
Hide file tree
Showing 148 changed files with 1,904 additions and 6,865 deletions.
1 change: 0 additions & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ Update instructions:
|----------------------|--------------------------------------------------------------------------|
| re_entity_db | In-memory storage of Rerun entities |
| re_query | Querying data in the re_data_store |
| re_query_cache | Caching datastructures for re_query |
| re_types | The built-in Rerun data types, component types, and archetypes. |
| re_types_blueprint | The core traits and types that power Rerun's Blueprint sub-system. |
| re_log_encoding | Helpers for encoding and transporting Rerun log messages |
Expand Down
75 changes: 8 additions & 67 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ 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_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 }
re_sdk_comms = { path = "crates/re_sdk_comms", version = "=0.16.0-alpha.2", default-features = false }
Expand Down
6 changes: 2 additions & 4 deletions crates/re_data_ui/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use std::sync::Arc;

use egui::NumExt;

use re_entity_db::{
external::re_query_cache::CachedLatestAtComponentResults, EntityPath, InstancePath,
};
use re_entity_db::{external::re_query::LatestAtComponentResults, EntityPath, InstancePath};
use re_types::ComponentName;
use re_ui::SyntaxHighlighting as _;
use re_viewer_context::{UiVerbosity, ViewerContext};
Expand All @@ -16,7 +14,7 @@ use crate::item_ui;
pub struct EntityLatestAtResults {
pub entity_path: EntityPath,
pub component_name: ComponentName,
pub results: Arc<CachedLatestAtComponentResults>,
pub results: Arc<LatestAtComponentResults>,
}

impl DataUi for EntityLatestAtResults {
Expand Down
4 changes: 2 additions & 2 deletions 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_cache::CachedLatestAtComponentResults, EntityDb};
use re_entity_db::{external::re_query::LatestAtComponentResults, EntityDb};
use re_log_types::{external::arrow2, EntityPath};
use re_types::external::arrow2::array::Utf8Array;
use re_viewer_context::{ComponentUiRegistry, UiVerbosity, ViewerContext};
Expand Down Expand Up @@ -62,7 +62,7 @@ fn fallback_component_ui(
_query: &LatestAtQuery,
db: &EntityDb,
_entity_path: &EntityPath,
component: &CachedLatestAtComponentResults,
component: &LatestAtComponentResults,
instance_key: &re_types::components::InstanceKey,
) {
// TODO(#5607): what should happen if the promise is still pending?
Expand Down
20 changes: 10 additions & 10 deletions 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_cache::CachedLatestAtComponentResults, EntityDb};
use re_entity_db::{external::re_query::LatestAtComponentResults, EntityDb};
use re_log_types::EntityPath;
use re_types::{
components::{
Expand All @@ -23,7 +23,7 @@ fn edit_color_ui(
db: &EntityDb,
entity_path: &EntityPath,
override_path: &EntityPath,
component: &CachedLatestAtComponentResults,
component: &LatestAtComponentResults,
instance_key: &re_types::components::InstanceKey,
) {
let current_color = component
Expand Down Expand Up @@ -66,7 +66,7 @@ fn edit_text_ui(
db: &EntityDb,
entity_path: &EntityPath,
override_path: &EntityPath,
component: &CachedLatestAtComponentResults,
component: &LatestAtComponentResults,
instance_key: &re_types::components::InstanceKey,
) {
let current_text = component
Expand Down Expand Up @@ -106,7 +106,7 @@ fn edit_name_ui(
db: &EntityDb,
entity_path: &EntityPath,
override_path: &EntityPath,
component: &CachedLatestAtComponentResults,
component: &LatestAtComponentResults,
instance_key: &re_types::components::InstanceKey,
) {
let current_text = component
Expand Down Expand Up @@ -147,7 +147,7 @@ fn edit_scatter_ui(
db: &EntityDb,
entity_path: &EntityPath,
override_path: &EntityPath,
component: &CachedLatestAtComponentResults,
component: &LatestAtComponentResults,
instance_key: &re_types::components::InstanceKey,
) {
let current_scatter = component
Expand Down Expand Up @@ -196,7 +196,7 @@ fn edit_radius_ui(
db: &EntityDb,
entity_path: &EntityPath,
override_path: &EntityPath,
component: &CachedLatestAtComponentResults,
component: &LatestAtComponentResults,
instance_key: &re_types::components::InstanceKey,
) {
let current_radius = component
Expand Down Expand Up @@ -243,7 +243,7 @@ fn edit_marker_shape_ui(
db: &EntityDb,
entity_path: &EntityPath,
override_path: &EntityPath,
component: &CachedLatestAtComponentResults,
component: &LatestAtComponentResults,
instance_key: &re_types::components::InstanceKey,
) {
let current_marker = component
Expand Down Expand Up @@ -329,7 +329,7 @@ fn edit_stroke_width_ui(
db: &EntityDb,
entity_path: &EntityPath,
override_path: &EntityPath,
component: &CachedLatestAtComponentResults,
component: &LatestAtComponentResults,
instance_key: &re_types::components::InstanceKey,
) {
let current_stroke_width = component
Expand Down Expand Up @@ -376,7 +376,7 @@ fn edit_marker_size_ui(
db: &EntityDb,
entity_path: &EntityPath,
override_path: &EntityPath,
component: &CachedLatestAtComponentResults,
component: &LatestAtComponentResults,
instance_key: &re_types::components::InstanceKey,
) {
let current_marker_size = component
Expand Down Expand Up @@ -425,7 +425,7 @@ fn register_editor<'a, C: Component + Loggable + 'static>(
&EntityDb,
&EntityPath,
&EntityPath,
&CachedLatestAtComponentResults,
&LatestAtComponentResults,
&re_types::components::InstanceKey,
),
) where
Expand Down
5 changes: 2 additions & 3 deletions crates/re_entity_db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ all-features = true
default = []

## Enable (de)serialization using serde.
serde = ["dep:serde", "dep:rmp-serde", "re_log_types/serde", "re_query/serde"]
serde = ["dep:serde", "dep:rmp-serde", "re_log_types/serde"]


[dependencies]
Expand All @@ -33,8 +33,7 @@ re_int_histogram.workspace = true
re_log.workspace = true
re_log_encoding = { workspace = true, features = ["decoder"] }
re_log_types.workspace = true
re_query.workspace = true
re_query_cache = { workspace = true, features = ["to_archetype"] }
re_query = { workspace = true, features = ["to_archetype"] }
re_smart_channel.workspace = true
re_tracing.workspace = true
re_types_core.workspace = true
Expand Down
Loading

0 comments on commit 8fe76ad

Please sign in to comment.