Skip to content

Commit 2646096

Browse files
authored
Reconcile historically messy RerunCloud extension types (#11418)
Due to historical organic messiness, some extension types had to be forked/duplicated/etc across the OSS and enterprise servers. With the new entry headers, that's no longer needed. Clean up the mess. * Sibling: rerun-io/dataplatform#1806
1 parent cb8a538 commit 2646096

File tree

2 files changed

+96
-2
lines changed

2 files changed

+96
-2
lines changed

crates/store/re_protos/src/v1alpha1/rerun.cloud.v1alpha1.ext.rs

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,79 @@ impl From<RegisterWithDatasetRequest> for crate::cloud::v1alpha1::RegisterWithDa
5959
}
6060
}
6161

62+
// --- QueryDatasetRequest ---
63+
64+
#[derive(Debug, Clone)]
65+
pub struct QueryDatasetRequest {
66+
pub partition_ids: Vec<crate::common::v1alpha1::ext::PartitionId>,
67+
pub chunk_ids: Vec<re_chunk::ChunkId>,
68+
pub entity_paths: Vec<EntityPath>,
69+
pub select_all_entity_paths: bool,
70+
pub fuzzy_descriptors: Vec<String>,
71+
pub exclude_static_data: bool,
72+
pub exclude_temporal_data: bool,
73+
pub scan_parameters: Option<crate::common::v1alpha1::ext::ScanParameters>,
74+
pub query: Option<Query>,
75+
}
76+
77+
impl TryFrom<crate::cloud::v1alpha1::QueryDatasetRequest> for QueryDatasetRequest {
78+
type Error = tonic::Status;
79+
80+
fn try_from(value: crate::cloud::v1alpha1::QueryDatasetRequest) -> Result<Self, Self::Error> {
81+
Ok(Self {
82+
partition_ids: value
83+
.partition_ids
84+
.into_iter()
85+
.map(TryInto::try_into)
86+
.collect::<Result<Vec<_>, _>>()?,
87+
88+
chunk_ids: value
89+
.chunk_ids
90+
.into_iter()
91+
.map(|tuid| {
92+
let id: re_tuid::Tuid = tuid.try_into()?;
93+
Ok::<_, tonic::Status>(re_chunk::ChunkId::from_u128(id.as_u128()))
94+
})
95+
.collect::<Result<Vec<_>, _>>()?,
96+
97+
entity_paths: value
98+
.entity_paths
99+
.into_iter()
100+
.map(|path| {
101+
path.try_into().map_err(|err| {
102+
tonic::Status::invalid_argument(format!("invalid entity path: {err}"))
103+
})
104+
})
105+
.collect::<Result<Vec<_>, _>>()?,
106+
107+
select_all_entity_paths: value.select_all_entity_paths,
108+
109+
fuzzy_descriptors: value.fuzzy_descriptors,
110+
111+
exclude_static_data: value.exclude_static_data,
112+
exclude_temporal_data: value.exclude_temporal_data,
113+
114+
scan_parameters: value
115+
.scan_parameters
116+
.map(|params| params.try_into())
117+
.transpose()?,
118+
119+
query: value.query.map(|q| q.try_into()).transpose()?,
120+
})
121+
}
122+
}
123+
62124
// --- GetChunksRequest --
63125

64126
#[derive(Debug, Clone)]
65127
pub struct GetChunksRequest {
66128
pub partition_ids: Vec<crate::common::v1alpha1::ext::PartitionId>,
67129
pub chunk_ids: Vec<re_chunk::ChunkId>,
68130
pub entity_paths: Vec<EntityPath>,
131+
pub select_all_entity_paths: bool,
132+
pub fuzzy_descriptors: Vec<String>,
133+
pub exclude_static_data: bool,
134+
pub exclude_temporal_data: bool,
69135
pub query: Option<Query>,
70136
}
71137

@@ -99,6 +165,13 @@ impl TryFrom<crate::cloud::v1alpha1::GetChunksRequest> for GetChunksRequest {
99165
})
100166
.collect::<Result<Vec<_>, _>>()?,
101167

168+
select_all_entity_paths: value.select_all_entity_paths,
169+
170+
fuzzy_descriptors: value.fuzzy_descriptors,
171+
172+
exclude_static_data: value.exclude_static_data,
173+
exclude_temporal_data: value.exclude_temporal_data,
174+
102175
query: value.query.map(|q| q.try_into()).transpose()?,
103176
})
104177
}
@@ -113,6 +186,25 @@ pub struct DoMaintenanceRequest {
113186
pub unsafe_allow_recent_cleanup: bool,
114187
}
115188

189+
impl TryFrom<crate::cloud::v1alpha1::DoMaintenanceRequest> for DoMaintenanceRequest {
190+
type Error = TypeConversionError;
191+
192+
fn try_from(value: crate::cloud::v1alpha1::DoMaintenanceRequest) -> Result<Self, Self::Error> {
193+
let cleanup_before = value
194+
.cleanup_before
195+
.map(|ts| jiff::Timestamp::new(ts.seconds, ts.nanos))
196+
.transpose()?;
197+
198+
Ok(Self {
199+
optimize_indexes: value.optimize_indexes,
200+
retrain_indexes: value.retrain_indexes,
201+
compact_fragments: value.compact_fragments,
202+
cleanup_before,
203+
unsafe_allow_recent_cleanup: value.unsafe_allow_recent_cleanup,
204+
})
205+
}
206+
}
207+
116208
impl From<DoMaintenanceRequest> for crate::cloud::v1alpha1::DoMaintenanceRequest {
117209
fn from(value: DoMaintenanceRequest) -> Self {
118210
Self {

crates/store/re_server/src/rerun_cloud.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,9 +928,11 @@ impl RerunCloudService for RerunCloudHandler {
928928
partition_ids,
929929
chunk_ids: _,
930930
entity_paths,
931-
932-
// We don't support queries, so you always get everything
933931
query: _,
932+
select_all_entity_paths: _,
933+
fuzzy_descriptors: _,
934+
exclude_static_data: _,
935+
exclude_temporal_data: _,
934936
} = GetChunksRequest::try_from(request.into_inner())?;
935937

936938
let entity_paths: IntSet<EntityPath> = entity_paths.into_iter().collect();

0 commit comments

Comments
 (0)