Skip to content

Commit

Permalink
Make the blueprint timeline useful with an option to disable GC
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Dec 22, 2023
1 parent 66a39cf commit 803fc04
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ impl eframe::App for App {
// Save the blueprints
// TODO(#2579): implement web-storage for blueprints as well
if let Some(hub) = &mut self.store_hub {
match hub.gc_and_persist_app_blueprints() {
match hub.gc_and_persist_app_blueprints(&self.state.app_options) {
Ok(f) => f,
Err(err) => {
re_log::error!("Saving blueprints failed: {err}");
Expand Down
11 changes: 8 additions & 3 deletions crates/re_viewer/src/store_hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use re_arrow_store::{DataStoreConfig, DataStoreStats};
use re_data_store::StoreDb;
use re_log_encoding::decoder::VersionPolicy;
use re_log_types::{ApplicationId, StoreId, StoreKind};
use re_viewer_context::StoreContext;
use re_viewer_context::{AppOptions, StoreContext};

use re_arrow_store::StoreGeneration;

Expand Down Expand Up @@ -278,7 +278,10 @@ impl StoreHub {
/// Persist any in-use blueprints to durable storage.
// TODO(#2579): implement persistence for web
#[allow(clippy::unnecessary_wraps)]
pub fn gc_and_persist_app_blueprints(&mut self) -> anyhow::Result<()> {
pub fn gc_and_persist_app_blueprints(
&mut self,
app_options: &AppOptions,
) -> anyhow::Result<()> {
re_tracing::profile_function!();
// Because we save blueprints based on their `ApplicationId`, we only
// save the blueprints referenced by `blueprint_by_app_id`, even though
Expand All @@ -287,7 +290,9 @@ impl StoreHub {
for (app_id, blueprint_id) in &self.blueprint_by_app_id {
if let Some(blueprint) = self.store_bundle.blueprint_mut(blueprint_id) {
if self.blueprint_last_save.get(blueprint_id) != Some(&blueprint.generation()) {
blueprint.gc_everything_but_the_latest_row();
if !app_options.disable_blueprint_gc {
blueprint.gc_everything_but_the_latest_row();
}

#[cfg(not(target_arch = "wasm32"))]
{
Expand Down
6 changes: 6 additions & 0 deletions crates/re_viewer/src/ui/rerun_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@ impl App {
)
.on_hover_text("Show the Blueprint data in the Time Panel tree view. This is useful for debugging the internal blueprint state.");

self.re_ui.checkbox(ui,
&mut self.state.app_options.disable_blueprint_gc,
"Disable the blueprint GC",
)
.on_hover_text("Don't GC the blueprint data. This is useful for debugging the internal blueprint state.");

self.re_ui
.checkbox(
ui,
Expand Down
5 changes: 5 additions & 0 deletions crates/re_viewer_context/src/app_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ pub struct AppOptions {
/// Includes the blueprint in the timeline view.
pub show_blueprint_in_timeline: bool,

/// Includes the blueprint in the timeline view.
pub disable_blueprint_gc: bool,

/// What time zone to display timestamps in.
pub time_zone_for_timestamps: TimeZone,
}
Expand All @@ -49,6 +52,8 @@ impl Default for AppOptions {

show_blueprint_in_timeline: false,

disable_blueprint_gc: false,

time_zone_for_timestamps: TimeZone::Utc,
}
}
Expand Down

0 comments on commit 803fc04

Please sign in to comment.