Skip to content

Commit e356a79

Browse files
authored
Migrate started time to recording properties (#9894)
1 parent 3928e65 commit e356a79

File tree

17 files changed

+87
-17
lines changed

17 files changed

+87
-17
lines changed

crates/store/re_data_loader/src/load_file.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ pub(crate) fn prepare_store_info(
101101
store_id: store_id.clone(),
102102
cloned_from: None,
103103
store_source,
104+
started: None,
104105
store_version: Some(re_build_info::CrateVersion::LOCAL),
105106
},
106107
})

crates/store/re_data_loader/src/loader_rrd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ mod tests {
354354
rustc_version: String::new(),
355355
llvm_version: String::new(),
356356
},
357+
started: None,
357358
store_version: Some(CrateVersion::LOCAL),
358359
},
359360
})

crates/store/re_grpc_client/src/redap/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ pub async fn stream_partition_async(
221221
store_id: store_id.clone(),
222222
cloned_from: None,
223223
store_source: StoreSource::Unknown,
224+
started: None,
224225
store_version: None,
225226
};
226227

crates/store/re_grpc_server/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,7 @@ mod tests {
856856
rustc_version: String::new(),
857857
llvm_version: String::new(),
858858
},
859+
started: None,
859860
store_version: Some(CrateVersion::LOCAL),
860861
},
861862
}));
@@ -905,6 +906,7 @@ mod tests {
905906
rustc_version: String::new(),
906907
llvm_version: String::new(),
907908
},
909+
started: None,
908910
store_version: Some(CrateVersion::LOCAL),
909911
},
910912
}));

crates/store/re_log_encoding/src/decoder/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ mod tests {
462462
rustc_version: String::new(),
463463
llvm_version: String::new(),
464464
},
465+
started: None,
465466
store_version: Some(CrateVersion::LOCAL),
466467
},
467468
}),

crates/store/re_log_encoding/src/decoder/stream.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ mod tests {
307307
store_id: StoreId::from_string(StoreKind::Recording, "test".into()),
308308
cloned_from: None,
309309
store_source: StoreSource::Unknown,
310+
started: None,
310311
store_version: Some(CrateVersion::LOCAL),
311312
},
312313
})

crates/store/re_log_encoding/src/legacy.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ impl LegacyLogMsg {
8989
application_id,
9090
store_id,
9191
cloned_from,
92+
started,
9293
} = info;
9394

9495
re_log_types::LogMsg::SetStoreInfo(re_log_types::SetStoreInfo {
@@ -98,6 +99,7 @@ impl LegacyLogMsg {
9899
store_id: store_id.migrate(),
99100
cloned_from: cloned_from.map(|id| id.migrate()),
100101
store_source: re_log_types::StoreSource::Unknown,
102+
started: Some(started),
101103
store_version: None,
102104
},
103105
})
@@ -296,5 +298,5 @@ pub struct LegacyStoreInfo {
296298
pub store_id: LegacyStoreId,
297299
pub cloned_from: Option<LegacyStoreId>,
298300
// pub is_official_example: bool,
299-
// pub started: LegacyTime,
301+
pub started: re_log_types::Time,
300302
}

crates/store/re_log_types/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ pub struct StoreInfo {
390390

391391
pub store_source: StoreSource,
392392

393+
/// When the recording started.
394+
pub started: Option<Time>,
395+
393396
/// The Rerun version used to encoded the RRD data.
394397
///
395398
// NOTE: The version comes directly from the decoded RRD stream's header, duplicating it here
@@ -405,6 +408,18 @@ impl StoreInfo {
405408
}
406409
}
407410

411+
/// A date-time represented as nanoseconds since unix epoch
412+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
413+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
414+
pub struct Time(i64);
415+
416+
impl Time {
417+
#[inline]
418+
pub fn nanos_since_epoch(self) -> i64 {
419+
self.0
420+
}
421+
}
422+
408423
#[derive(Clone, PartialEq, Eq)]
409424
pub struct PythonVersion {
410425
/// e.g. 3
@@ -753,6 +768,7 @@ impl SizeBytes for StoreInfo {
753768
store_id,
754769
cloned_from: _,
755770
store_source,
771+
started: _,
756772
store_version,
757773
} = self;
758774

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ impl TryFrom<crate::log_msg::v1alpha1::StoreInfo> for re_log_types::StoreInfo {
653653
store_id,
654654
cloned_from: None,
655655
store_source,
656+
started: None,
656657
store_version,
657658
})
658659
}
@@ -1152,6 +1153,7 @@ mod tests {
11521153
patch: 0,
11531154
suffix: "a".to_owned(),
11541155
}),
1156+
started: None,
11551157
store_version: None,
11561158
};
11571159
let proto_store_info: crate::log_msg::v1alpha1::StoreInfo = store_info.clone().into();
@@ -1176,6 +1178,7 @@ mod tests {
11761178
patch: 0,
11771179
suffix: "a".to_owned(),
11781180
}),
1181+
started: None,
11791182
store_version: None,
11801183
},
11811184
};

crates/top/re_sdk/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ pub fn new_store_info(
217217
rustc_version: env!("RE_BUILD_RUSTC_VERSION").into(),
218218
llvm_version: env!("RE_BUILD_LLVM_VERSION").into(),
219219
},
220+
started: None,
220221
store_version: Some(re_build_info::CrateVersion::LOCAL),
221222
}
222223
}

0 commit comments

Comments
 (0)