Skip to content

Commit

Permalink
enable using StoreId as recording unique identifier on the remote…
Browse files Browse the repository at this point in the history
… store side (rerun-io#7954)

### What

Few more type conversions in remote store types are needed so we can use
``StoreId`` as the unique recording id identifier.

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7954?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7954?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7954)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.

---------

Co-authored-by: Clement Rey <[email protected]>
  • Loading branch information
zehiko and teh-cmc authored Oct 31, 2024
1 parent b58ecac commit b87dc35
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions crates/store/re_remote_store_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,33 @@ pub mod v0 {

// ==== below are all necessary transforms from internal rerun types to protobuf types =====

use std::collections::BTreeSet;
use std::{collections::BTreeSet, sync::Arc};

#[derive(Debug, thiserror::Error)]
pub enum TypeConversionError {
#[error("missing required field: {0}")]
MissingField(&'static str),
}

impl From<RecordingId> for re_log_types::StoreId {
#[inline]
fn from(value: RecordingId) -> Self {
Self {
kind: re_log_types::StoreKind::Recording,
id: Arc::new(value.id),
}
}
}

impl From<re_log_types::StoreId> for RecordingId {
#[inline]
fn from(value: re_log_types::StoreId) -> Self {
Self {
id: value.id.to_string(),
}
}
}

impl From<re_log_types::ResolvedTimeRange> for TimeRange {
fn from(time_range: re_log_types::ResolvedTimeRange) -> Self {
Self {
Expand Down Expand Up @@ -332,8 +351,8 @@ mod tests {
use crate::v0::{
column_selector::SelectorType, ColumnSelection, ColumnSelector, Component,
ComponentColumnSelector, ComponentsSet, EntityPath, IndexColumnSelector, IndexRange,
IndexValues, Query, SparseFillStrategy, TimeInt, TimeRange, Timeline, ViewContents,
ViewContentsPart,
IndexValues, Query, RecordingId, SparseFillStrategy, TimeInt, TimeRange, Timeline,
ViewContents, ViewContentsPart,
};

#[test]
Expand Down Expand Up @@ -405,4 +424,16 @@ mod tests {

assert_eq!(grpc_query_before, grpc_query_after);
}

#[test]
fn test_recording_id_conversion() {
let recording_id = RecordingId {
id: "recording_id".to_owned(),
};

let store_id: re_log_types::StoreId = recording_id.clone().into();
let recording_id_after: RecordingId = store_id.into();

assert_eq!(recording_id, recording_id_after);
}
}

0 comments on commit b87dc35

Please sign in to comment.