Skip to content

Commit 3a6ed38

Browse files
authored
Remove some dead code from re_redap_client (#11362)
1 parent de82981 commit 3a6ed38

File tree

4 files changed

+14
-93
lines changed

4 files changed

+14
-93
lines changed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9203,7 +9203,6 @@ dependencies = [
92039203
"re_arrow_util",
92049204
"re_auth",
92059205
"re_chunk",
9206-
"re_error",
92079206
"re_log",
92089207
"re_log_encoding",
92099208
"re_log_types",
@@ -9220,7 +9219,6 @@ dependencies = [
92209219
"tower",
92219220
"tracing",
92229221
"url",
9223-
"wasm-bindgen-futures",
92249222
]
92259223

92269224
[[package]]

crates/store/re_redap_client/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ all-features = true
3434
re_arrow_util.workspace = true
3535
re_auth.workspace = true
3636
re_chunk.workspace = true
37-
re_error.workspace = true
3837
re_log.workspace = true
3938
re_log_encoding = { workspace = true, features = ["encoder", "decoder"] }
4039
re_log_types.workspace = true
@@ -65,5 +64,4 @@ tonic = { workspace = true, default-features = false, features = [
6564
# Web dependencies:
6665
[target.'cfg(target_arch = "wasm32")'.dependencies]
6766
tonic-web-wasm-client.workspace = true
68-
wasm-bindgen-futures.workspace = true
6967
tonic = { workspace = true, default-features = false }

crates/store/re_redap_client/src/grpc.rs

Lines changed: 14 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ use re_protos::cloud::v1alpha1::GetChunksRequest;
88
use re_protos::cloud::v1alpha1::ext::{Query, QueryLatestAt, QueryRange};
99
use re_protos::cloud::v1alpha1::rerun_cloud_service_client::RerunCloudServiceClient;
1010
use re_protos::common::v1alpha1::ext::PartitionId;
11-
use re_uri::{DatasetPartitionUri, Origin, TimeSelection};
11+
use re_uri::{Origin, TimeSelection};
1212

1313
use tokio_stream::{Stream, StreamExt as _};
1414

15-
use crate::{
16-
ConnectionClient, ConnectionRegistryHandle, MAX_DECODING_MESSAGE_SIZE, StreamError,
17-
StreamPartitionError, spawn_future,
18-
};
15+
use crate::{ConnectionClient, MAX_DECODING_MESSAGE_SIZE, StreamError, StreamPartitionError};
1916

2017
/// UI commands issued when streaming in datasets.
2118
///
@@ -35,55 +32,6 @@ pub enum UiCommand {
3532
},
3633
}
3734

38-
/// Stream an rrd file or metadata catalog over gRPC from a Rerun Data Platform server.
39-
///
40-
/// `on_msg` can be used to wake up the UI thread on Wasm.
41-
pub fn stream_dataset_from_redap(
42-
connection_registry: &ConnectionRegistryHandle,
43-
uri: DatasetPartitionUri,
44-
on_ui_cmd: Option<Box<dyn Fn(UiCommand) + Send + Sync>>,
45-
on_msg: Option<Box<dyn Fn() + Send + Sync>>,
46-
) -> re_smart_channel::Receiver<LogMsg> {
47-
re_log::debug!("Loading {uri}…");
48-
49-
let (tx, rx) = re_smart_channel::smart_channel(
50-
re_smart_channel::SmartMessageSource::RedapGrpcStream {
51-
uri: uri.clone(),
52-
select_when_loaded: true,
53-
},
54-
re_smart_channel::SmartChannelSource::RedapGrpcStream {
55-
uri: uri.clone(),
56-
select_when_loaded: true,
57-
},
58-
);
59-
60-
async fn stream_partition(
61-
connection_registry: ConnectionRegistryHandle,
62-
tx: re_smart_channel::Sender<LogMsg>,
63-
uri: DatasetPartitionUri,
64-
on_ui_cmd: Option<Box<dyn Fn(UiCommand) + Send + Sync>>,
65-
on_msg: Option<Box<dyn Fn() + Send + Sync>>,
66-
) -> Result<(), StreamError> {
67-
let client = connection_registry.client(uri.origin.clone()).await?;
68-
69-
stream_blueprint_and_partition_from_server(client, tx, uri.clone(), on_ui_cmd, on_msg).await
70-
}
71-
72-
let connection_registry = connection_registry.clone();
73-
spawn_future(async move {
74-
if let Err(err) =
75-
stream_partition(connection_registry, tx, uri.clone(), on_ui_cmd, on_msg).await
76-
{
77-
re_log::error!(
78-
"Error while streaming {uri}: {}",
79-
re_error::format_ref(&err)
80-
);
81-
}
82-
});
83-
84-
rx
85-
}
86-
8735
// TODO(ab): do not publish this out of this crate (for now it is still being used by rerun_py
8836
// the viewer grpc connection). Ideally we'd only publish `ClientConnectionError`.
8937
#[derive(Debug, thiserror::Error)]
@@ -568,9 +516,20 @@ async fn stream_partition_from_server(
568516

569517
let store_id = store_info.store_id.clone();
570518

519+
if tx
520+
.send(LogMsg::SetStoreInfo(SetStoreInfo {
521+
row_id: *re_chunk::RowId::new(),
522+
info: store_info,
523+
}))
524+
.is_err()
525+
{
526+
re_log::debug!("Receiver disconnected");
527+
return Ok(());
528+
}
529+
571530
// Send UI commands for recording (as opposed to blueprint) stores.
572531
if let Some(on_ui_cmd) = on_ui_cmd
573-
&& store_info.store_id.is_recording()
532+
&& store_id.is_recording()
574533
{
575534
if let Some(time_range) = time_range {
576535
on_ui_cmd(UiCommand::AddValidTimeRange {
@@ -594,17 +553,6 @@ async fn stream_partition_from_server(
594553
}
595554
}
596555

597-
if tx
598-
.send(LogMsg::SetStoreInfo(SetStoreInfo {
599-
row_id: *re_chunk::RowId::new(),
600-
info: store_info,
601-
}))
602-
.is_err()
603-
{
604-
re_log::debug!("Receiver disconnected");
605-
return Ok(());
606-
}
607-
608556
// TODO(#10229): this looks to be converting back and forth?
609557

610558
let static_chunk_stream = get_chunks_response_to_chunk_and_partition_id(static_chunk_stream);

crates/store/re_redap_client/src/lib.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub use self::{
1313
ConnectionError, RedapClient, UiCommand, channel,
1414
fetch_chunks_response_to_chunk_and_partition_id,
1515
get_chunks_response_to_chunk_and_partition_id, stream_blueprint_and_partition_from_server,
16-
stream_dataset_from_redap,
1716
},
1817
};
1918

@@ -157,25 +156,3 @@ const _: () = assert!(
157156
std::mem::size_of::<StreamError>() <= 80,
158157
"Error type is too large. Try to reduce its size by boxing some of its variants.",
159158
);
160-
161-
// TODO(ab, andreas): This should be replaced by the use of `AsyncRuntimeHandle`. However, this
162-
// requires:
163-
// - `AsyncRuntimeHandle` to be moved lower in the crate hierarchy to be available here (unsure
164-
// where).
165-
// - Make sure that all callers of `DataSource::stream` have access to an `AsyncRuntimeHandle`
166-
// (maybe it should be in `GlobalContext`?).
167-
#[cfg(target_arch = "wasm32")]
168-
fn spawn_future<F>(future: F)
169-
where
170-
F: std::future::Future<Output = ()> + 'static,
171-
{
172-
wasm_bindgen_futures::spawn_local(future);
173-
}
174-
175-
#[cfg(not(target_arch = "wasm32"))]
176-
fn spawn_future<F>(future: F)
177-
where
178-
F: std::future::Future<Output = ()> + 'static + Send,
179-
{
180-
tokio::spawn(future);
181-
}

0 commit comments

Comments
 (0)