Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break out re_log_types::component_types as re_components #2258

Merged
merged 12 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ The web viewer can load `.rrd` files (just drag-drop them into the browser), or
NOTE: `.rrd` files do not yet guarantee any backwards or forwards compatibility. One version of Rerun will likely not be able to open an `.rrd` file generated by another Rerun version.


## Crates
In order to get an overview of our in-house crates and how they depend on each other, we recommend you run:

```
cargo install cargo-depgraph
cargo depgraph --all-deps --workspace-only --all-features --dedup-transitive-deps | dot -Tpng > deps.png
open deps.png
Comment on lines +44 to +46
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this one but I'm on the fence on how useful it is for learning

```

and:

```
cargo doc --no-deps --open
```

and then browse through the `re_*` crates.


## Technologies we use
### Apache Arrow
[Apache Arrow](https://arrow.apache.org/) is a language-independent columnar memory format for arbitrary data. We use it to encode the log data when transmitting it over the network or storing it in an `.rrd` file. We also use it in our in-RAM data store, [`re_arrow_store`](crates/re_arrow_store/README.md).
Expand Down
51 changes: 41 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ re_arrow_store = { path = "crates/re_arrow_store", version = "0.7.0-alpha.0", de
re_build_build_info = { path = "crates/re_build_build_info", version = "0.7.0-alpha.0", default-features = false }
re_build_info = { path = "crates/re_build_info", version = "0.7.0-alpha.0", default-features = false }
re_build_web_viewer = { path = "crates/re_build_web_viewer", version = "0.7.0-alpha.0", default-features = false }
re_components = { path = "crates/re_components", version = "0.7.0-alpha.0", default-features = false }
re_crash_handler = { path = "crates/re_crash_handler", version = "0.7.0-alpha.0", default-features = false }
re_data_store = { path = "crates/re_data_store", version = "0.7.0-alpha.0", default-features = false }
re_data_ui = { path = "crates/re_data_ui", version = "0.7.0-alpha.0", default-features = false }
Expand Down
2 changes: 2 additions & 0 deletions crates/re_arrow_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ polars-ops = { workspace = true, optional = true, features = [


[dev-dependencies]
re_components = { workspace = true, features = ["arrow_datagen"] }

anyhow.workspace = true
criterion = "0.5"
mimalloc.workspace = true
Expand Down
10 changes: 6 additions & 4 deletions crates/re_arrow_store/benches/arrow2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ use std::sync::Arc;
use arrow2::array::{Array, PrimitiveArray, StructArray, UnionArray};
use criterion::{criterion_group, Criterion};
use itertools::Itertools;
use re_log_types::{
component_types::{InstanceKey, Point2D, Rect2D},
use re_components::{
datagen::{build_some_instances, build_some_point2d, build_some_rects},
external::arrow2_convert::serialize::TryIntoArrow,
DataCell, SerializableComponent, SizeBytes as _,
Point2D, Rect2D,
};
use re_log_types::{
external::arrow2_convert::serialize::TryIntoArrow, DataCell, InstanceKey,
SerializableComponent, SizeBytes as _,
};

// ---
Expand Down
3 changes: 1 addition & 2 deletions crates/re_arrow_store/benches/arrow2_convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
use arrow2::{array::PrimitiveArray, datatypes::PhysicalType, types::PrimitiveType};
use criterion::{criterion_group, Criterion};
use re_log_types::{
component_types::InstanceKey, external::arrow2_convert::deserialize::TryIntoCollection,
Component as _, DataCell,
external::arrow2_convert::deserialize::TryIntoCollection, Component as _, DataCell, InstanceKey,
};

// ---
Expand Down
10 changes: 6 additions & 4 deletions crates/re_arrow_store/benches/data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ use re_arrow_store::{
DataStore, DataStoreConfig, GarbageCollectionTarget, LatestAtQuery, RangeQuery, TimeInt,
TimeRange,
};
use re_log_types::{
component_types::{InstanceKey, Rect2D},
use re_components::{
datagen::{build_frame_nr, build_some_instances, build_some_rects},
Component as _, ComponentName, DataCell, DataRow, DataTable, EntityPath, RowId, TableId,
TimeType, Timeline,
Rect2D,
};
use re_log_types::{
Component as _, ComponentName, DataCell, DataRow, DataTable, EntityPath, InstanceKey, RowId,
TableId, TimeType, Timeline,
};

criterion_group!(benches, insert, latest_at, latest_at_missing, range, gc);
Expand Down
11 changes: 4 additions & 7 deletions crates/re_arrow_store/examples/dump_dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
//! ```

use re_arrow_store::{test_row, DataStore};
use re_log_types::{
component_types::InstanceKey,
datagen::{
build_frame_nr, build_log_time, build_some_instances, build_some_instances_from,
build_some_point2d, build_some_rects,
},
Component as _, EntityPath, Time,
use re_components::datagen::{
build_frame_nr, build_log_time, build_some_instances, build_some_instances_from,
build_some_point2d, build_some_rects,
};
use re_log_types::{Component as _, EntityPath, InstanceKey, Time};

// ---

Expand Down
10 changes: 4 additions & 6 deletions crates/re_arrow_store/examples/latest_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

use re_arrow_store::polars_util::latest_component;
use re_arrow_store::{test_row, DataStore, LatestAtQuery, TimeType, Timeline};
use re_log_types::component_types::Rect2D;
use re_log_types::datagen::build_some_rects;
use re_log_types::{
component_types::{InstanceKey, Point2D},
datagen::{build_frame_nr, build_some_point2d},
Component, EntityPath,
use re_components::{
datagen::{build_frame_nr, build_some_point2d, build_some_rects},
Point2D, Rect2D,
};
use re_log_types::{Component, EntityPath, InstanceKey};

fn main() {
let mut store = DataStore::new(InstanceKey::name(), Default::default());
Expand Down
7 changes: 4 additions & 3 deletions crates/re_arrow_store/examples/latest_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
//! ```

use polars_core::prelude::*;

use re_arrow_store::polars_util::latest_components;
use re_arrow_store::{test_row, DataStore, LatestAtQuery, TimeType, Timeline};
use re_log_types::{
component_types::{InstanceKey, Point2D, Rect2D},
use re_components::{
datagen::{build_frame_nr, build_some_point2d, build_some_rects},
Component, EntityPath,
Point2D, Rect2D,
};
use re_log_types::{Component, EntityPath, InstanceKey};

fn main() {
let mut store = DataStore::new(InstanceKey::name(), Default::default());
Expand Down
6 changes: 3 additions & 3 deletions crates/re_arrow_store/examples/range_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

use polars_core::prelude::JoinType;
use re_arrow_store::{polars_util, test_row, DataStore, RangeQuery, TimeRange};
use re_log_types::{
component_types::{InstanceKey, Point2D, Rect2D},
use re_components::{
datagen::{build_frame_nr, build_some_point2d, build_some_rects},
Component as _, EntityPath, TimeType, Timeline,
Point2D, Rect2D,
};
use re_log_types::{Component as _, EntityPath, InstanceKey, TimeType, Timeline};

fn main() {
let mut store = DataStore::new(InstanceKey::name(), Default::default());
Expand Down
7 changes: 4 additions & 3 deletions crates/re_arrow_store/src/arrow_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl ArrayExt for dyn Array {

#[test]
fn test_clean_for_polars_nomodify() {
use re_log_types::datagen::build_some_colors;
use re_components::datagen::build_some_colors;
use re_log_types::DataCell;

// Colors don't need polars cleaning
Expand All @@ -237,7 +237,8 @@ fn test_clean_for_polars_nomodify() {
mod tests {
use arrow2::datatypes::{DataType, Field, UnionMode};
use arrow2_convert::{ArrowDeserialize, ArrowField, ArrowSerialize};
use re_log_types::{component_types::Vec3D, Component, DataCell};
use re_components::Vec3D;
use re_log_types::DataCell;

use crate::ArrayExt;

Expand All @@ -248,7 +249,7 @@ mod tests {
Vec3D(Vec3D),
}

impl Component for TestComponentWithUnionAndFixedSizeList {
impl re_log_types::Component for TestComponentWithUnionAndFixedSizeList {
fn name() -> re_log_types::ComponentName {
"test_component_with_union_and_fixed_size_list".into()
}
Expand Down
11 changes: 6 additions & 5 deletions crates/re_arrow_store/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::sync::atomic::AtomicU64;

use ahash::HashMap;
use arrow2::datatypes::DataType;
use smallvec::SmallVec;

use nohash_hasher::{IntMap, IntSet};
use parking_lot::RwLock;
use smallvec::SmallVec;

use re_log_types::{
ComponentName, DataCell, DataCellColumn, EntityPath, EntityPathHash, ErasedTimeVec,
NumInstancesVec, RowId, RowIdVec, SizeBytes, TimeInt, TimePoint, TimeRange, Timeline,
Expand Down Expand Up @@ -324,7 +324,8 @@ impl DataStore {
/// ```
#[test]
fn datastore_internal_repr() {
use re_log_types::{component_types::InstanceKey, Component as _, DataTable};
use re_components::datagen::data_table_example;
use re_log_types::{Component as _, InstanceKey};

let mut store = DataStore::new(
InstanceKey::name(),
Expand All @@ -335,11 +336,11 @@ fn datastore_internal_repr() {
},
);

let timeless = DataTable::example(true);
let timeless = data_table_example(true);
eprintln!("{timeless}");
store.insert_table(&timeless).unwrap();

let temporal = DataTable::example(false);
let temporal = data_table_example(false);
eprintln!("{temporal}");
store.insert_table(&temporal).unwrap();

Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/src/store_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use smallvec::SmallVec;

use re_log::{debug, trace};
use re_log_types::{
component_types::InstanceKey, ComponentName, DataCell, DataCellColumn, DataCellError, DataRow,
DataTable, RowId, SizeBytes as _, TimeInt, TimePoint, TimeRange,
ComponentName, DataCell, DataCellColumn, DataCellError, DataRow, DataTable, InstanceKey, RowId,
SizeBytes as _, TimeInt, TimePoint, TimeRange,
};

use crate::{
Expand Down
Loading