diff --git a/Cargo.lock b/Cargo.lock index 0489153b0..26c1ed77b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -175,11 +175,12 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", + "once_cell", "windows-sys 0.59.0", ] @@ -483,9 +484,9 @@ dependencies = [ [[package]] name = "async-graphql" -version = "7.0.13" +version = "7.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59fd6bd734afb8b6e4d0f84a3e77305ce0a7ccc60d70f6001cb5e1c3f38d8ff1" +checksum = "e0a9916334e00a14428e03b9b1c73a0baf1c834ebe0ff1be146e1247390b31f1" dependencies = [ "async-graphql-derive", "async-graphql-parser", @@ -517,9 +518,9 @@ dependencies = [ [[package]] name = "async-graphql-derive" -version = "7.0.13" +version = "7.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac38b4dd452d529d6c0248b51df23603f0a875770352e26ae8c346ce6c149b3e" +checksum = "88d6f3ad293f7b9974aef6297673ac3e9097824f84264a9548cbb87006c94044" dependencies = [ "Inflector", "async-graphql-parser", @@ -534,9 +535,9 @@ dependencies = [ [[package]] name = "async-graphql-parser" -version = "7.0.13" +version = "7.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d271ddda2f55b13970928abbcbc3423cfc18187c60e8769b48f21a93b7adaa" +checksum = "7ca5697e57fcad289d26948e2ab2f11b9cfe7d645503a1f37fa86640c061c772" dependencies = [ "async-graphql-value", "pest", @@ -546,9 +547,9 @@ dependencies = [ [[package]] name = "async-graphql-poem" -version = "7.0.13" +version = "7.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edf0a22e338958f4a12383e8970d440b4b64a4358102ddc00632e7c5006c2146" +checksum = "a6587867c160695e16e92cc6f97d853f9d707a3589773eb051dc6dd37e99bd93" dependencies = [ "async-graphql", "futures-util", @@ -563,9 +564,9 @@ dependencies = [ [[package]] name = "async-graphql-value" -version = "7.0.13" +version = "7.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aefe909173a037eaf3281b046dc22580b59a38b765d7b8d5116f2ffef098048d" +checksum = "6266ea7ab3ce41585e16caa0e1e8d97de37827227950820fdab6b69d9c09a63a" dependencies = [ "bytes", "indexmap 2.7.0", @@ -860,7 +861,7 @@ checksum = "cc97b8f16f944bba54f0433f07e30be199b6dc2bd25937444bbad560bcea29bd" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", - "brotli-decompressor 4.0.1", + "brotli-decompressor 4.0.2", ] [[package]] @@ -875,9 +876,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "4.0.1" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +checksum = "74fa05ad7d803d413eb8380983b092cbbaf9a85f151b871360e7b00cd7060b37" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -1077,9 +1078,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.23" +version = "4.5.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" +checksum = "769b0145982b4b48713e01ec42d61614425f27b7058bda7180a3a41f30104796" dependencies = [ "clap_builder", "clap_derive", @@ -1087,9 +1088,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.23" +version = "4.5.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" +checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7" dependencies = [ "anstream", "anstyle", @@ -1099,9 +1100,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -1456,9 +1457,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f" [[package]] name = "datafusion" @@ -2301,6 +2302,19 @@ dependencies = [ "slab", ] +[[package]] +name = "generator" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd" +dependencies = [ + "cfg-if", + "libc", + "log", + "rustversion", + "windows", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -2348,9 +2362,9 @@ checksum = "dc46dd3ec48fdd8e693a98d2b8bafae273a2d54c1de02a2a7e3d57d501f39677" [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "h2" @@ -2734,7 +2748,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -2960,13 +2974,13 @@ checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is-terminal" -version = "0.4.13" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" +checksum = "e19b23d53f35ce9f56aebc7d1bb4e6ac1e9c0db7ac85c8d1760c04379edced37" dependencies = [ "hermit-abi 0.4.0", "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3196,6 +3210,19 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "loom" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + [[package]] name = "lru" version = "0.12.5" @@ -3396,21 +3423,20 @@ dependencies = [ [[package]] name = "moka" -version = "0.12.8" +version = "0.12.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cf62eb4dd975d2dde76432fb1075c49e3ee2331cf36f1f8fd4b66550d32b6f" +checksum = "a9321642ca94a4282428e6ea4af8cc2ca4eac48ac7a6a4ea8f33f76d0ce70926" dependencies = [ "crossbeam-channel", "crossbeam-epoch", "crossbeam-utils", - "once_cell", + "loom", "parking_lot", - "quanta", + "portable-atomic", "rustc_version", "smallvec", "tagptr", "thiserror 1.0.69", - "triomphe", "uuid", ] @@ -3687,9 +3713,9 @@ dependencies = [ [[package]] name = "object_store" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb4c22c6154a1e759d7099f9ffad7cc5ef8245f9efbab4a41b92623079c82f3" +checksum = "3cfccb68961a56facde1163f9319e0d15743352344e7808a11795fb99698dcaf" dependencies = [ "async-trait", "bytes", @@ -4077,18 +4103,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +checksum = "1e2ec53ad785f4d35dac0adea7f7dc6f1bb277ad84a680c7afefeae05d1f5916" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb" dependencies = [ "proc-macro2", "quote", @@ -4152,9 +4178,9 @@ dependencies = [ [[package]] name = "poem" -version = "3.1.5" +version = "3.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671795ac42dc4ea9210e44942e8e9844c16541d799499aec2747ab8d4fef50ef" +checksum = "d32edf6781dc01de285cf2b1bd5dc5a3fd0d96aa5c4680e356c0462fab8f793a" dependencies = [ "base64 0.22.1", "bytes", @@ -4179,7 +4205,7 @@ dependencies = [ "serde_urlencoded", "smallvec", "sync_wrapper 1.0.2", - "thiserror 1.0.69", + "thiserror 2.0.7", "time", "tokio", "tokio-tungstenite", @@ -4657,21 +4683,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a651516ddc9168ebd67b24afd085a718be02f8858fe406591b013d101ce2f40" -[[package]] -name = "quanta" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773ce68d0bb9bc7ef20be3536ffe94e223e1f365bd374108b2659fac0c65cfe6" -dependencies = [ - "crossbeam-utils", - "libc", - "once_cell", - "raw-cpuid", - "wasi", - "web-sys", - "winapi", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -5509,6 +5520,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" @@ -5706,13 +5723,13 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "simple_asn1" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +checksum = "297f631f50729c8c99b84667867963997ec0b50f32b2a7dbcab828ef0541e8bb" dependencies = [ "num-bigint", "num-traits", - "thiserror 1.0.69", + "thiserror 2.0.7", "time", ] @@ -6375,9 +6392,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.23.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6989540ced10490aaf14e6bad2e3d33728a2813310a0c71d1574304c49631cd" +checksum = "c28562dd8aea311048ed1ab9372a6b9a59977e1b308afb87c985c1f2b3206938" dependencies = [ "futures-util", "log", @@ -6441,7 +6458,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.20", + "winnow 0.6.24", ] [[package]] @@ -6599,12 +6616,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "triomphe" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" - [[package]] name = "try-lock" version = "0.2.5" @@ -6613,9 +6624,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.23.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8" +checksum = "326eb16466ed89221beef69dbc94f517ee888bae959895472133924a25f7070e" dependencies = [ "byteorder", "bytes", @@ -6625,7 +6636,7 @@ dependencies = [ "log", "rand", "sha1", - "thiserror 1.0.69", + "thiserror 2.0.7", "utf-8", ] @@ -6971,6 +6982,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core 0.58.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -6980,6 +7001,41 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "windows-registry" version = "0.2.0" @@ -7169,9 +7225,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a" dependencies = [ "memchr", ] diff --git a/raphtory-benchmark/src/common/mod.rs b/raphtory-benchmark/src/common/mod.rs index 1fb6e500a..caf4247db 100644 --- a/raphtory-benchmark/src/common/mod.rs +++ b/raphtory-benchmark/src/common/mod.rs @@ -575,7 +575,6 @@ pub fn run_graph_ops_benches( } pub fn run_proto_encode_benchmark(group: &mut BenchmarkGroup, graph: Graph) { - println!("graph: {graph}"); bench(group, "proto_encode", None, |b: &mut Bencher| { b.iter_batched( || TempDir::new().unwrap(), @@ -586,7 +585,6 @@ pub fn run_proto_encode_benchmark(group: &mut BenchmarkGroup, graph: G } pub fn run_proto_decode_benchmark(group: &mut BenchmarkGroup, graph: Graph) { - println!("graph: {graph}"); let f = TempDir::new().unwrap(); graph.encode(f.path()).unwrap(); bench(group, "proto_decode", None, |b| { diff --git a/raphtory/resources/test/old_graph_proto.bin/.raph b/raphtory/resources/test/old_proto/all_props/.raph similarity index 100% rename from raphtory/resources/test/old_graph_proto.bin/.raph rename to raphtory/resources/test/old_proto/all_props/.raph diff --git a/raphtory/resources/test/old_graph_proto.bin/graph b/raphtory/resources/test/old_proto/all_props/graph similarity index 100% rename from raphtory/resources/test/old_graph_proto.bin/graph rename to raphtory/resources/test/old_proto/all_props/graph diff --git a/raphtory/resources/test/old_proto/str/.raph b/raphtory/resources/test/old_proto/str/.raph new file mode 100644 index 000000000..e69de29bb diff --git a/raphtory/resources/test/old_proto/str/graph b/raphtory/resources/test/old_proto/str/graph new file mode 100644 index 000000000..bdb0f9c7f Binary files /dev/null and b/raphtory/resources/test/old_proto/str/graph differ diff --git a/raphtory/src/algorithms/community_detection/louvain.rs b/raphtory/src/algorithms/community_detection/louvain.rs index 5b0b9a120..293017c1c 100644 --- a/raphtory/src/algorithms/community_detection/louvain.rs +++ b/raphtory/src/algorithms/community_detection/louvain.rs @@ -75,8 +75,6 @@ mod test { test_storage, }; use proptest::prelude::*; - #[cfg(feature = "io")] - use tracing::info; #[cfg(feature = "io")] use raphtory_api::core::utils::logging::global_info_logger; @@ -171,8 +169,8 @@ mod test { .unwrap(); test_storage!(&graph, |graph| { - let result = louvain::(graph, 1.0, None, None); - info!("{result:?}") + let _ = louvain::(graph, 1.0, None, None); + // TODO: Add assertions }); } } diff --git a/raphtory/src/algorithms/pathing/single_source_shortest_path.rs b/raphtory/src/algorithms/pathing/single_source_shortest_path.rs index df1711c4e..b97ba8058 100644 --- a/raphtory/src/algorithms/pathing/single_source_shortest_path.rs +++ b/raphtory/src/algorithms/pathing/single_source_shortest_path.rs @@ -70,7 +70,6 @@ mod sssp_tests { test_storage, }; use raphtory_api::core::utils::logging::global_info_logger; - use tracing::info; fn load_graph(edges: Vec<(i64, u64, u64)>) -> Graph { let graph = Graph::new(); @@ -120,8 +119,7 @@ mod sssp_tests { for (node, values) in expected { assert_eq!(results.get_by_node(node).unwrap().name(), values); } - let binding = single_source_shortest_path(graph, 5, Some(4)); - info!("{:?}", binding); + let _ = single_source_shortest_path(graph, 5, Some(4)); }); } } diff --git a/raphtory/src/db/graph/views/deletion_graph.rs b/raphtory/src/db/graph/views/deletion_graph.rs index 05cbbf152..f9b3e497d 100644 --- a/raphtory/src/db/graph/views/deletion_graph.rs +++ b/raphtory/src/db/graph/views/deletion_graph.rs @@ -700,8 +700,7 @@ mod test_deletions { test_storage, }; use itertools::Itertools; - use raphtory_api::core::{entities::GID, utils::logging::global_info_logger}; - use tracing::info; + use raphtory_api::core::entities::GID; #[test] fn test_nodes() { @@ -1226,70 +1225,6 @@ mod test_deletions { assert_eq!(v.latest_time(), Some(i64::MAX)); } - #[test] - fn test_jira() { - global_info_logger(); - let g = PersistentGraph::new(); - - g.add_edge(0, 1, 2, [("added", Prop::I64(0))], Some("assigned")) - .unwrap(); - g.add_edge(1, 1, 3, [("added", Prop::I64(0))], Some("assigned")) - .unwrap(); - g.add_edge(2, 4, 2, [("added", Prop::I64(0))], Some("has")) - .unwrap(); - g.add_edge(3, 4, 2, [("added", Prop::I64(0))], Some("has")) - .unwrap(); - g.add_edge(4, 5, 2, [("added", Prop::I64(0))], Some("blocks")) - .unwrap(); - g.add_edge(5, 4, 5, [("added", Prop::I64(0))], Some("has")) - .unwrap(); - g.add_edge(6, 6, 5, [("added", Prop::I64(0))], Some("assigned")) - .unwrap(); - - let nodes = g - .window(0, 1701786285758) - .layers(vec!["assigned", "has", "blocks"]) - .unwrap() - .edges() - .into_iter() - .map(|vv| vv.id()) - .collect_vec(); - - info!("windowed edges = {:?}", nodes); - - let nodes = g - .window(0, 1701786285758) - .layers(vec!["assigned", "has", "blocks"]) - .unwrap() - .nodes() - .into_iter() - .map(|vv| vv.name()) - .collect_vec(); - - info!("windowed nodes = {:?}", nodes); - - let nodes = g - .at(1701786285758) - .layers(vec!["assigned", "has", "blocks"]) - .unwrap() - .edges() - .into_iter() - .map(|vv| vv.id()) - .collect_vec(); - info!("at edges = {:?}", nodes); - - let nodes = g - .at(1701786285758) - .layers(vec!["assigned", "has", "blocks"]) - .unwrap() - .nodes() - .into_iter() - .map(|vv| vv.id()) - .collect_vec(); - - info!("at nodes = {:?}", nodes); - } - #[test] fn test_event_graph() { let pg = PersistentGraph::new(); diff --git a/raphtory/src/serialise/graph.proto b/raphtory/src/serialise/graph.proto index 515b77283..681339cd9 100644 --- a/raphtory/src/serialise/graph.proto +++ b/raphtory/src/serialise/graph.proto @@ -40,35 +40,35 @@ message NewMeta { message NewGraphTProp { string name = 1; uint64 id = 2; - optional PropType.PropType p_type = 3 [deprecated=true]; + PropType.PropType p_type = 3 [deprecated=true]; PropType.PType p_type2 = 4; } message NewNodeCProp { string name = 1; uint64 id = 2; - optional PropType.PropType p_type = 3 [deprecated=true]; + PropType.PropType p_type = 3 [deprecated=true]; PropType.PType p_type2 = 4; } message NewNodeTProp { string name = 1; uint64 id = 2; - optional PropType.PropType p_type = 3[deprecated=true]; + PropType.PropType p_type = 3[deprecated=true]; PropType.PType p_type2 = 4; } message NewEdgeCProp { string name = 1; uint64 id = 2; - optional PropType.PropType p_type = 3[deprecated=true]; + PropType.PropType p_type = 3[deprecated=true]; PropType.PType p_type2 = 4; } message NewEdgeTProp { string name = 1; uint64 id = 2; - optional PropType.PropType p_type = 3 [deprecated=true]; + PropType.PropType p_type = 3 [deprecated=true]; PropType.PType p_type2 = 4; } diff --git a/raphtory/src/serialise/proto_ext.rs b/raphtory/src/serialise/proto_ext.rs index 2abeaae87..3b016aaae 100644 --- a/raphtory/src/serialise/proto_ext.rs +++ b/raphtory/src/serialise/proto_ext.rs @@ -235,24 +235,21 @@ impl UpdateNodeTProps { } pub(crate) trait PropTypeExt { - fn p_type(&self) -> Option; + fn p_type(&self) -> SPropType; fn p_type2(&self) -> Option<&PType>; - fn prop_type(&self) -> Option { + fn prop_type(&self) -> PropType { self.p_type2() .and_then(|p_type| as_prop_type2(*p_type)) - .or_else(|| { - self.p_type() - .as_ref() - .and_then(|p_type| as_prop_type(prop_type_from_i32(*p_type)?)) - }) + .or_else(|| as_prop_type(self.p_type())) + .unwrap_or(PropType::Empty) } } impl PropTypeExt for NewNodeCProp { #[allow(deprecated)] - fn p_type(&self) -> Option { - self.p_type + fn p_type(&self) -> SPropType { + self.p_type() } fn p_type2(&self) -> Option<&PType> { @@ -262,8 +259,8 @@ impl PropTypeExt for NewNodeCProp { impl PropTypeExt for NewNodeTProp { #[allow(deprecated)] - fn p_type(&self) -> Option { - self.p_type + fn p_type(&self) -> SPropType { + self.p_type() } fn p_type2(&self) -> Option<&PType> { @@ -273,8 +270,8 @@ impl PropTypeExt for NewNodeTProp { impl PropTypeExt for NewEdgeCProp { #[allow(deprecated)] - fn p_type(&self) -> Option { - self.p_type + fn p_type(&self) -> SPropType { + self.p_type() } fn p_type2(&self) -> Option<&PType> { @@ -284,8 +281,8 @@ impl PropTypeExt for NewEdgeCProp { impl PropTypeExt for NewEdgeTProp { #[allow(deprecated)] - fn p_type(&self) -> Option { - self.p_type + fn p_type(&self) -> SPropType { + self.p_type() } fn p_type2(&self) -> Option<&PType> { @@ -295,8 +292,8 @@ impl PropTypeExt for NewEdgeTProp { impl PropTypeExt for NewGraphTProp { #[allow(deprecated)] - fn p_type(&self) -> Option { - self.p_type + fn p_type(&self) -> SPropType { + self.p_type() } fn p_type2(&self) -> Option<&PType> { diff --git a/raphtory/src/serialise/serialise.rs b/raphtory/src/serialise/serialise.rs index e216fcc7a..615bea918 100644 --- a/raphtory/src/serialise/serialise.rs +++ b/raphtory/src/serialise/serialise.rs @@ -283,57 +283,52 @@ impl StableDecode for TemporalGraph { .set_id(node_type.name.as_str(), node_type.id as usize); } Meta::NewNodeCprop(node_cprop) => { - if let Some(p_type) = node_cprop.prop_type() { - storage.node_meta.const_prop_meta().set_id_and_dtype( - node_cprop.name.as_str(), - node_cprop.id as usize, - p_type, - ) - } + let p_type = node_cprop.prop_type(); + storage.node_meta.const_prop_meta().set_id_and_dtype( + node_cprop.name.as_str(), + node_cprop.id as usize, + p_type, + ) } Meta::NewNodeTprop(node_tprop) => { - if let Some(p_type) = node_tprop.prop_type() { - storage.node_meta.temporal_prop_meta().set_id_and_dtype( - node_tprop.name.as_str(), - node_tprop.id as usize, - p_type, - ) - } + let p_type = node_tprop.prop_type(); + storage.node_meta.temporal_prop_meta().set_id_and_dtype( + node_tprop.name.as_str(), + node_tprop.id as usize, + p_type, + ) } Meta::NewGraphCprop(graph_cprop) => storage .graph_meta .const_prop_meta() .set_id(graph_cprop.name.as_str(), graph_cprop.id as usize), Meta::NewGraphTprop(graph_tprop) => { - if let Some(p_type) = graph_tprop.prop_type() { - storage.graph_meta.temporal_prop_meta().set_id_and_dtype( - graph_tprop.name.as_str(), - graph_tprop.id as usize, - p_type, - ) - } + let p_type = graph_tprop.prop_type(); + storage.graph_meta.temporal_prop_meta().set_id_and_dtype( + graph_tprop.name.as_str(), + graph_tprop.id as usize, + p_type, + ) } Meta::NewLayer(new_layer) => storage .edge_meta .layer_meta() .set_id(new_layer.name.as_str(), new_layer.id as usize), Meta::NewEdgeCprop(edge_cprop) => { - if let Some(p_type) = edge_cprop.prop_type() { - storage.edge_meta.const_prop_meta().set_id_and_dtype( - edge_cprop.name.as_str(), - edge_cprop.id as usize, - p_type, - ) - } + let p_type = edge_cprop.prop_type(); + storage.edge_meta.const_prop_meta().set_id_and_dtype( + edge_cprop.name.as_str(), + edge_cprop.id as usize, + p_type, + ) } Meta::NewEdgeTprop(edge_tprop) => { - if let Some(p_type) = edge_tprop.prop_type() { - storage.edge_meta.temporal_prop_meta().set_id_and_dtype( - edge_tprop.name.as_str(), - edge_tprop.id as usize, - p_type, - ) - } + let p_type = edge_tprop.prop_type(); + storage.edge_meta.temporal_prop_meta().set_id_and_dtype( + edge_tprop.name.as_str(), + edge_tprop.id as usize, + p_type, + ) } } } @@ -570,11 +565,35 @@ mod proto_test { use proptest::proptest; use raphtory_api::core::storage::arc_str::ArcStr; + #[test] + fn prev_proto_str() { + let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .parent() + .map(|p| p.join("raphtory/resources/test/old_proto/str")) + .unwrap(); + + let graph = Graph::decode(path).unwrap(); + + let nodes = graph + .nodes() + .properties() + .into_iter() + .flat_map(|(_, props)| props.into_iter()) + .collect::>(); + assert_eq!( + nodes, + vec![ + ("a".into(), Some("a".into())), + ("z".into(), Some("a".into())), + ("a".into(), None) + ] + ); + } #[test] fn can_read_previous_proto() { let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) .parent() - .map(|p| p.join("raphtory/resources/test/old_graph_proto.bin")) + .map(|p| p.join("raphtory/resources/test/old_proto/all_props")) .unwrap(); let graph = Graph::decode(path).unwrap(); @@ -594,7 +613,14 @@ mod proto_test { .collect(); let expected: HashMap>> = [ - ("name".into(), vec![None, None, None]), + ( + "name".into(), + vec![ + Some("Alice".into()), + Some("Alice".into()), + Some("Alice".into()), + ], + ), ( "age".into(), vec![