Skip to content

Commit 812a72c

Browse files
authored
fix formatting and parsing of component paths in links (#11364)
1 parent cf6bf32 commit 812a72c

File tree

24 files changed

+243
-258
lines changed

24 files changed

+243
-258
lines changed

crates/store/re_chunk_store/src/query.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ use std::{
66
use itertools::{Either, Itertools as _};
77
use nohash_hasher::IntSet;
88

9-
use re_chunk::{
10-
ArchetypeName, Chunk, ComponentIdentifier, LatestAtQuery, RangeQuery, TimelineName,
11-
};
9+
use re_chunk::{Chunk, ComponentIdentifier, LatestAtQuery, RangeQuery, TimelineName};
1210
use re_log_types::AbsoluteTimeRange;
1311
use re_log_types::{EntityPath, TimeInt, Timeline};
1412
use re_types_core::{
@@ -282,12 +280,9 @@ impl ChunkStore {
282280
pub fn entity_component_descriptor(
283281
&self,
284282
entity_path: &EntityPath,
285-
archetype_name: Option<ArchetypeName>,
286283
identifier: ComponentIdentifier,
287284
) -> Option<ComponentDescriptor> {
288-
let matches = |descr: &&ComponentDescriptor| {
289-
descr.component == identifier && descr.archetype == archetype_name
290-
};
285+
let matches = |descr: &&ComponentDescriptor| descr.component == identifier;
291286

292287
let static_chunks = self.static_chunk_ids_per_entity.get(entity_path);
293288
let static_components_descr =

crates/store/re_dataframe/src/query.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,7 @@ impl<E: StorageEngineLike> QueryHandle<E> {
346346
re_chunk::LatestAtQuery::new(TimelineName::new(""), TimeInt::STATIC);
347347

348348
let component_descriptor = store
349-
.entity_component_descriptor(
350-
&descr.entity_path,
351-
descr.archetype,
352-
descr.component,
353-
)
349+
.entity_component_descriptor(&descr.entity_path, descr.component)
354350
.into_iter()
355351
.next()?;
356352

@@ -1067,11 +1063,7 @@ impl<E: StorageEngineLike> QueryHandle<E> {
10671063
re_chunk::LatestAtQuery::new(state.filtered_index, *cur_index_value);
10681064

10691065
let component_descriptor = store
1070-
.entity_component_descriptor(
1071-
&descr.entity_path,
1072-
descr.archetype,
1073-
descr.component,
1074-
)
1066+
.entity_component_descriptor(&descr.entity_path, descr.component)
10751067
.into_iter()
10761068
.next()?;
10771069

crates/store/re_entity_db/src/instance_path.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,11 @@ impl FromStr for InstancePath {
100100
let DataPath {
101101
entity_path,
102102
instance,
103-
component_descriptor,
103+
component,
104104
} = DataPath::from_str(s)?;
105105

106-
if let Some(component_descriptor) = component_descriptor {
107-
return Err(PathParseError::UnexpectedComponentDescriptor(
108-
component_descriptor.into(),
109-
));
106+
if let Some(component) = component {
107+
return Err(PathParseError::UnexpectedComponent(component));
110108
}
111109

112110
let instance = instance.unwrap_or(Instance::ALL);
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use re_types_core::ComponentDescriptor;
1+
use re_types_core::ComponentIdentifier;
22

33
use crate::path::EntityPath;
44

5-
/// A [`EntityPath`] plus a [`ComponentDescriptor`].
5+
/// A [`EntityPath`] plus a [`ComponentIdentifier`].
66
///
77
/// Example: `camera/left/points:Points3D:color`
88
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -12,15 +12,15 @@ pub struct ComponentPath {
1212
pub entity_path: EntityPath,
1313

1414
/// e.g. `Points3D:color`
15-
pub component_descriptor: ComponentDescriptor,
15+
pub component: ComponentIdentifier,
1616
}
1717

1818
impl ComponentPath {
1919
#[inline]
20-
pub fn new(entity_path: EntityPath, component_descriptor: ComponentDescriptor) -> Self {
20+
pub fn new(entity_path: EntityPath, component: ComponentIdentifier) -> Self {
2121
Self {
2222
entity_path,
23-
component_descriptor,
23+
component,
2424
}
2525
}
2626

@@ -30,16 +30,16 @@ impl ComponentPath {
3030
}
3131

3232
#[inline]
33-
pub fn component_descriptor(&self) -> &ComponentDescriptor {
34-
&self.component_descriptor
33+
pub fn component(&self) -> &ComponentIdentifier {
34+
&self.component
3535
}
3636
}
3737

3838
impl std::fmt::Display for ComponentPath {
3939
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4040
self.entity_path.fmt(f)?;
4141
f.write_str(":")?;
42-
self.component_descriptor.fmt(f)?;
42+
self.component.fmt(f)?;
4343
Ok(())
4444
}
4545
}

crates/store/re_log_types/src/path/data_path.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use re_types_core::ComponentDescriptor;
1+
use re_types_core::ComponentIdentifier;
22

33
use crate::{EntityPath, Instance};
44

55
/// A general path to some data.
66
///
77
/// This always starts with an [`EntityPath`], followed by an optional instance index,
8-
/// followed by an optional [`ComponentDescriptor`].
8+
/// followed by an optional [`ComponentIdentifier`].
99
///
1010
/// For instance:
1111
///
@@ -17,7 +17,7 @@ use crate::{EntityPath, Instance};
1717
pub struct DataPath {
1818
pub entity_path: EntityPath,
1919
pub instance: Option<Instance>,
20-
pub component_descriptor: Option<ComponentDescriptor>,
20+
pub component: Option<ComponentIdentifier>,
2121
}
2222

2323
impl std::fmt::Display for DataPath {
@@ -28,8 +28,9 @@ impl std::fmt::Display for DataPath {
2828
{
2929
write!(f, "[#{instance}]")?;
3030
}
31-
if let Some(component_descriptor) = &self.component_descriptor {
32-
write!(f, ":{component_descriptor:?}")?;
31+
if let Some(component) = &self.component {
32+
f.write_str(":")?;
33+
component.fmt(f)?;
3334
}
3435
Ok(())
3536
}

0 commit comments

Comments
 (0)