diff --git a/crates/store/re_grpc_client/src/lib.rs b/crates/store/re_grpc_client/src/lib.rs index 487d27098508..be5fa4ba2f99 100644 --- a/crates/store/re_grpc_client/src/lib.rs +++ b/crates/store/re_grpc_client/src/lib.rs @@ -22,7 +22,8 @@ use re_protos::{ common::v0::RecordingId, remote_store::v0::{ storage_node_client::StorageNodeClient, CatalogFilter, FetchRecordingRequest, - QueryCatalogRequest, + QueryCatalogRequest, CATALOG_APP_ID_FIELD_NAME, CATALOG_ID_FIELD_NAME, + CATALOG_START_TIME_FIELD_NAME, }, }; use re_types::{ @@ -283,27 +284,33 @@ pub fn store_info_from_catalog_chunk( let (_field, data) = tc .components() - .find(|(f, _)| f.name() == "application_id") + .find(|(f, _)| f.name() == CATALOG_APP_ID_FIELD_NAME) .ok_or(StreamError::ChunkError(re_chunk::ChunkError::Malformed { - reason: "no application_id field found".to_owned(), + reason: "no {CATALOG_APP_ID_FIELD_NAME} field found".to_owned(), }))?; let app_id = data .downcast_array_ref::() .ok_or(StreamError::ChunkError(re_chunk::ChunkError::Malformed { - reason: format!("application_id must be a utf8 array: {:?}", tc.schema_ref()), + reason: format!( + "{CATALOG_APP_ID_FIELD_NAME} must be a utf8 array: {:?}", + tc.schema_ref() + ), }))? .value(0); let (_field, data) = tc .components() - .find(|(f, _)| f.name() == "start_time") + .find(|(f, _)| f.name() == CATALOG_START_TIME_FIELD_NAME) .ok_or(StreamError::ChunkError(re_chunk::ChunkError::Malformed { - reason: "no start_time field found".to_owned(), + reason: "no {CATALOG_START_TIME_FIELD_NAME}} field found".to_owned(), }))?; let start_time = data - .downcast_array_ref::() + .downcast_array_ref::() .ok_or(StreamError::ChunkError(re_chunk::ChunkError::Malformed { - reason: format!("start_time must be an int64 array: {:?}", tc.schema_ref()), + reason: format!( + "{CATALOG_START_TIME_FIELD_NAME} must be a Timestamp array: {:?}", + tc.schema_ref() + ), }))? .value(0); @@ -485,7 +492,7 @@ async fn stream_catalog_async( )))?; let recording_uri_arrays: Vec = chunk - .iter_slices::("id".into()) + .iter_slices::(CATALOG_ID_FIELD_NAME.into()) .map(|id| { let rec_id = &id[0]; // each component batch is of length 1 i.e. single 'id' value diff --git a/crates/store/re_protos/src/lib.rs b/crates/store/re_protos/src/lib.rs index e41036697752..df3a13b66375 100644 --- a/crates/store/re_protos/src/lib.rs +++ b/crates/store/re_protos/src/lib.rs @@ -48,8 +48,20 @@ pub mod log_msg { /// Generated types for the remote store gRPC service API v0. pub mod remote_store { + pub mod v0 { pub use crate::v0::rerun_remote_store_v0::*; + + /// Recording catalog mandatory field names. All mandatory metadata fields are prefixed + /// with "rerun_" to avoid conflicts with user-defined fields. + pub const CATALOG_ID_FIELD_NAME: &str = "rerun_recording_id"; + pub const CATALOG_APP_ID_FIELD_NAME: &str = "rerun_application_id"; + pub const CATALOG_START_TIME_FIELD_NAME: &str = "rerun_start_time"; + pub const CATALOG_DESCRIPTION_FIELD_NAME: &str = "rerun_description"; + pub const CATALOG_RECORDING_TYPE_FIELD_NAME: &str = "rerun_recording_type"; + pub const CATALOG_STORAGE_URL_FIELD_NAME: &str = "rerun_storage_url"; + pub const CATALOG_REGISTRATION_TIME_FIELD_NAME: &str = "rerun_registration_time"; + pub const CATALOG_ROW_ID_FIELD_NAME: &str = "rerun_row_id"; } }