From d1349955b1dee5cd025d29f93ff6f8b79e12a10b Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Sun, 11 Dec 2022 20:03:53 +0800 Subject: [PATCH] make everything compile again --- cozo-core/Cargo.toml | 14 +----- cozo-core/src/data/functions.rs | 14 +++--- cozo-core/src/fixed_rule/algos/mod.rs | 34 ++++++++------ .../{utilities => algos}/random_walk.rs | 0 cozo-core/src/fixed_rule/mod.rs | 47 ++++--------------- cozo-core/src/fixed_rule/utilities/mod.rs | 6 ++- cozo-core/src/lib.rs | 6 +-- cozo-core/src/parse/query.rs | 5 +- cozo-core/src/runtime/db.rs | 12 ++--- cozo-core/src/storage/mem.rs | 4 +- cozo-core/src/storage/sqlite.rs | 3 -- cozo-lib-c/Cargo.toml | 8 +--- cozo-lib-java/Cargo.toml | 8 +--- cozo-lib-nodejs/Cargo.toml | 8 +--- cozo-lib-python/Cargo.toml | 8 +--- cozo-lib-swift/Cargo.toml | 8 +--- cozo-lib-wasm/Cargo.toml | 2 +- cozo-lib-wasm/wasm-react-demo/src/App.js | 19 ++++---- cozoserver/Cargo.toml | 8 +--- 19 files changed, 76 insertions(+), 138 deletions(-) rename cozo-core/src/fixed_rule/{utilities => algos}/random_walk.rs (100%) diff --git a/cozo-core/Cargo.toml b/cozo-core/Cargo.toml index 713397a5..79b88f25 100644 --- a/cozo-core/Cargo.toml +++ b/cozo-core/Cargo.toml @@ -17,7 +17,7 @@ exclude = [ default = ["compact"] ## Enables the `minimal`, `requests` and `graph-algo` features. -compact = ["minimal", "requests", "graph-algo", "rayon"] +compact = ["minimal", "requests", "graph-algo"] ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode. compact-single-threaded = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` feature. @@ -33,7 +33,7 @@ storage-sqlite = ["dep:sqlite", "dep:sqlite3-src"] ## You can also [fine-tune](https://github.com/cozodb/cozo/blob/main/TUNING_ROCKSDB.md) RocksDB options. storage-rocksdb = ["dep:cozorocks"] ## Enables the graph algorithms. -graph-algo = [] +graph-algo = ["graph", "rayon"] ## Allows the utilities to make web requests to fetch data. requests = ["dep:minreq"] ## Uses jemalloc as the global allocator, can make a difference in performance. @@ -42,10 +42,6 @@ jemalloc = ["dep:tikv-jemallocator-global", "cozorocks?/jemalloc"] io-uring = ["cozorocks?/io-uring"] ## Polyfills for the WASM target wasm = ["uuid/js", "dep:js-sys"] -## Allows threading and enables the use of the `rayon` library for parallelizing algorithms. -rayon = ["dep:rayon", "dep:graph"] -## Disallows the use of threads. -nothread = [] #! The following features are highly experimental: @@ -67,12 +63,6 @@ storage-tikv = ["dep:tikv-client", "dep:tokio"] #! (utilities are still available), #! which could be OK if you only want to deal with pure Datalog. #! -#! If having multiple threads -#! running in the background is undesirable, you can enable the `nothread` feature. -#! -#! The `rayon` feature enables some algorithms to make use of parallelism. This is desirable in most circumstances. -#! Naturally, it is incompatible with `nothread`. -#! #! The `requests` feature allows the database to make outgoing HTTP requests to fetch data #! into queries -- only enable it if you need it. #! diff --git a/cozo-core/src/data/functions.rs b/cozo-core/src/data/functions.rs index 891a818e..a1190eda 100644 --- a/cozo-core/src/data/functions.rs +++ b/cozo-core/src/data/functions.rs @@ -13,7 +13,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; use chrono::{DateTime, TimeZone, Utc}; use itertools::Itertools; -#[cfg(feature = "wasm")] +#[cfg(all(target_arch = "wasm32", target_os = "unknown"))] use js_sys::Date; use miette::{bail, ensure, miette, Result}; use num_traits::FloatConst; @@ -1462,12 +1462,12 @@ pub(crate) fn op_to_uuid(args: &[DataValue]) -> Result { } define_op!(OP_NOW, 0, false); -#[cfg(feature = "wasm")] +#[cfg(all(target_arch = "wasm32", target_os = "unknown"))] pub(crate) fn op_now(_args: &[DataValue]) -> Result { let d: f64 = Date::now() / 1000.; Ok(DataValue::from(d)) } -#[cfg(not(feature = "wasm"))] +#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] pub(crate) fn op_now(_args: &[DataValue]) -> Result { let now = SystemTime::now(); Ok(DataValue::from( @@ -1477,12 +1477,12 @@ pub(crate) fn op_now(_args: &[DataValue]) -> Result { define_op!(OP_FORMAT_TIMESTAMP, 1, true); pub(crate) fn op_format_timestamp(args: &[DataValue]) -> Result { - #[cfg(feature = "wasm")] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] let dt = Utc .timestamp_millis_opt(Date::now() as i64) .latest() .ok_or_else(|| miette!("bad time input"))?; - #[cfg(not(feature = "wasm"))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] let dt = { let f = args[0] .get_float() @@ -1526,14 +1526,14 @@ define_op!(OP_RAND_UUID_V1, 0, false); pub(crate) fn op_rand_uuid_v1(_args: &[DataValue]) -> Result { let mut rng = rand::thread_rng(); let uuid_ctx = uuid::v1::Context::new(rng.gen()); - #[cfg(feature = "wasm")] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] let ts = { let since_epoch: f64 = Date::now(); let seconds = since_epoch.floor(); let fractional = (since_epoch - seconds) * 1.0e9; Timestamp::from_unix(uuid_ctx, seconds as u64, fractional as u32) }; - #[cfg(not(feature = "wasm"))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] let ts = { let now = SystemTime::now(); let since_epoch = now.duration_since(UNIX_EPOCH).unwrap(); diff --git a/cozo-core/src/fixed_rule/algos/mod.rs b/cozo-core/src/fixed_rule/algos/mod.rs index bda5e6e0..1761a51c 100644 --- a/cozo-core/src/fixed_rule/algos/mod.rs +++ b/cozo-core/src/fixed_rule/algos/mod.rs @@ -6,34 +6,38 @@ * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#[cfg(feature = "graph-algo")] pub(crate) mod all_pairs_shortest_path; -#[cfg(feature = "graph-algo")] pub(crate) mod astar; -#[cfg(feature = "graph-algo")] pub(crate) mod bfs; -#[cfg(feature = "graph-algo")] pub(crate) mod degree_centrality; -#[cfg(feature = "graph-algo")] pub(crate) mod dfs; -#[cfg(feature = "graph-algo")] pub(crate) mod kruskal; -#[cfg(feature = "graph-algo")] pub(crate) mod label_propagation; -#[cfg(feature = "graph-algo")] pub(crate) mod louvain; -#[cfg(feature = "graph-algo")] pub(crate) mod pagerank; -#[cfg(feature = "graph-algo")] pub(crate) mod prim; -#[cfg(feature = "graph-algo")] pub(crate) mod shortest_path_dijkstra; pub(crate) mod strongly_connected_components; -#[cfg(feature = "graph-algo")] pub(crate) mod top_sort; -#[cfg(feature = "graph-algo")] pub(crate) mod triangles; -#[cfg(feature = "graph-algo")] pub(crate) mod yen; -#[cfg(feature = "graph-algo")] pub(crate) mod shortest_path_bfs; +pub(crate) mod random_walk; + +pub(crate) use all_pairs_shortest_path::{BetweennessCentrality, ClosenessCentrality}; +pub(crate) use astar::ShortestPathAStar; +pub(crate) use bfs::Bfs; +pub(crate) use degree_centrality::DegreeCentrality; +pub(crate) use dfs::Dfs; +pub(crate) use kruskal::MinimumSpanningForestKruskal; +pub(crate) use label_propagation::LabelPropagation; +pub(crate) use louvain::CommunityDetectionLouvain; +pub(crate) use pagerank::PageRank; +pub(crate) use prim::MinimumSpanningTreePrim; +pub(crate) use shortest_path_dijkstra::ShortestPathDijkstra; +pub(crate) use strongly_connected_components::StronglyConnectedComponent; +pub(crate) use top_sort::TopSort; +pub(crate) use triangles::ClusteringCoefficients; +pub(crate) use yen::KShortestPathYen; +pub(crate) use shortest_path_bfs::ShortestPathBFS; +pub(crate) use random_walk::RandomWalk; \ No newline at end of file diff --git a/cozo-core/src/fixed_rule/utilities/random_walk.rs b/cozo-core/src/fixed_rule/algos/random_walk.rs similarity index 100% rename from cozo-core/src/fixed_rule/utilities/random_walk.rs rename to cozo-core/src/fixed_rule/algos/random_walk.rs diff --git a/cozo-core/src/fixed_rule/mod.rs b/cozo-core/src/fixed_rule/mod.rs index 18e72153..24b06a89 100644 --- a/cozo-core/src/fixed_rule/mod.rs +++ b/cozo-core/src/fixed_rule/mod.rs @@ -9,9 +9,12 @@ use std::collections::BTreeMap; use std::sync::Arc; +#[allow(unused_imports)] use either::{Left, Right}; +#[cfg(feature = "graph-algo")] use graph::prelude::{CsrLayout, DirectedCsrGraph, GraphBuilder}; use lazy_static::lazy_static; +#[allow(unused_imports)] use miette::{bail, ensure, Diagnostic, Report, Result}; use smartstring::{LazyCompact, SmartString}; use thiserror::Error; @@ -25,49 +28,14 @@ use crate::data::symb::Symbol; use crate::data::tuple::TupleIter; use crate::data::value::DataValue; #[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::all_pairs_shortest_path::{ - BetweennessCentrality, ClosenessCentrality, -}; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::astar::ShortestPathAStar; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::bfs::Bfs; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::degree_centrality::DegreeCentrality; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::dfs::Dfs; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::kruskal::MinimumSpanningForestKruskal; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::label_propagation::LabelPropagation; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::louvain::CommunityDetectionLouvain; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::pagerank::PageRank; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::prim::MinimumSpanningTreePrim; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::shortest_path_bfs::ShortestPathBFS; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::shortest_path_dijkstra::ShortestPathDijkstra; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::strongly_connected_components::StronglyConnectedComponent; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::top_sort::TopSort; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::triangles::ClusteringCoefficients; -#[cfg(feature = "graph-algo")] -use crate::fixed_rule::algos::yen::KShortestPathYen; -use crate::fixed_rule::utilities::constant::Constant; -use crate::fixed_rule::utilities::csv::CsvReader; -use crate::fixed_rule::utilities::jlines::JsonReader; -use crate::fixed_rule::utilities::random_walk::RandomWalk; -use crate::fixed_rule::utilities::reorder_sort::ReorderSort; +use crate::fixed_rule::algos::*; +use crate::fixed_rule::utilities::*; use crate::parse::SourceSpan; use crate::runtime::db::Poison; use crate::runtime::temp_store::{EpochStore, RegularTempStore}; use crate::runtime::transact::SessionTx; +#[cfg(feature = "graph-algo")] pub(crate) mod algos; pub(crate) mod utilities; @@ -138,6 +106,7 @@ impl<'a, 'b> FixedRuleInputRelation<'a, 'b> { pub fn span(&self) -> SourceSpan { self.arg_manifest.span() } + #[cfg(feature = "graph-algo")] pub fn to_directed_graph( &self, undirected: bool, @@ -203,7 +172,7 @@ impl<'a, 'b> FixedRuleInputRelation<'a, 'b> { } Ok((graph, indices, inv_indices)) } - + #[cfg(feature = "graph-algo")] pub fn to_directed_weighted_graph( &self, undirected: bool, diff --git a/cozo-core/src/fixed_rule/utilities/mod.rs b/cozo-core/src/fixed_rule/utilities/mod.rs index a441748c..e5149992 100644 --- a/cozo-core/src/fixed_rule/utilities/mod.rs +++ b/cozo-core/src/fixed_rule/utilities/mod.rs @@ -9,5 +9,9 @@ pub(crate) mod constant; pub(crate) mod csv; pub(crate) mod jlines; -pub(crate) mod random_walk; pub(crate) mod reorder_sort; + +pub(crate) use constant::Constant; +pub(crate) use self::csv::CsvReader; +pub(crate) use jlines::JsonReader; +pub(crate) use reorder_sort::ReorderSort; \ No newline at end of file diff --git a/cozo-core/src/lib.rs b/cozo-core/src/lib.rs index 488f9ca8..57a5bd70 100644 --- a/cozo-core/src/lib.rs +++ b/cozo-core/src/lib.rs @@ -177,17 +177,17 @@ impl DbInstance { payload: &str, params: BTreeMap, ) -> JsonValue { - #[cfg(not(feature = "wasm"))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] let start = Instant::now(); match self.run_script(payload, params) { Ok(named_rows) => { let mut j_val = named_rows.into_json(); - #[cfg(not(feature = "wasm"))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] let took = start.elapsed().as_secs_f64(); let map = j_val.as_object_mut().unwrap(); map.insert("ok".to_string(), json!(true)); - #[cfg(not(feature = "wasm"))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] map.insert("took".to_string(), json!(took)); j_val diff --git a/cozo-core/src/parse/query.rs b/cozo-core/src/parse/query.rs index 594e4e73..755b0735 100644 --- a/cozo-core/src/parse/query.rs +++ b/cozo-core/src/parse/query.rs @@ -238,9 +238,10 @@ pub(crate) fn parse_query( out_opts.timeout = Some(timeout); } Rule::sleep_option => { - #[cfg(feature = "wasm")] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] bail!(":sleep is not supported under WASM"); - #[cfg(not(feature = "wasm"))] + + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] { let pair = pair.into_inner().next().unwrap(); let span = pair.extract_span(); diff --git a/cozo-core/src/runtime/db.rs b/cozo-core/src/runtime/db.rs index bcde0700..12c235f3 100644 --- a/cozo-core/src/runtime/db.rs +++ b/cozo-core/src/runtime/db.rs @@ -507,7 +507,7 @@ impl<'s, S: Storage<'s>> Db { let (q_res, q_cleanups) = self.run_query(&mut tx, p)?; res = q_res; cleanups.extend(q_cleanups); - #[cfg(not(feature = "wasm"))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] if let Some(secs) = sleep_opt { thread::sleep(Duration::from_micros((secs * 1000000.) as u64)); } @@ -867,15 +867,15 @@ impl<'s, S: Storage<'s>> Db { let id = self.queries_count.fetch_add(1, Ordering::AcqRel); // time the query - #[cfg(not(feature = "wasm"))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] let now = SystemTime::now(); - #[cfg(not(feature = "wasm"))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] let since_the_epoch = now .duration_since(UNIX_EPOCH) .into_diagnostic()? .as_secs_f64(); - #[cfg(feature = "wasm")] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] let since_the_epoch = js_sys::Date::now(); let handle = RunningQueryHandle { @@ -1151,11 +1151,11 @@ impl Poison { } Ok(()) } - #[cfg(feature = "nothread")] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] pub(crate) fn set_timeout(&self, _secs: f64) -> Result<()> { bail!("Cannot set timeout when threading is disallowed"); } - #[cfg(not(feature = "nothread"))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] pub(crate) fn set_timeout(&self, secs: f64) -> Result<()> { let pill = self.clone(); thread::spawn(move || { diff --git a/cozo-core/src/storage/mem.rs b/cozo-core/src/storage/mem.rs index 01686feb..cdd2ba56 100644 --- a/cozo-core/src/storage/mem.rs +++ b/cozo-core/src/storage/mem.rs @@ -67,9 +67,9 @@ impl<'s> Storage<'s> for MemStorage { wtr.remove(k); } }; - #[cfg(feature = "nothread")] + #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] closure(); - #[cfg(not(feature = "nothread"))] + #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] std::thread::spawn(closure); Ok(()) } diff --git a/cozo-core/src/storage/sqlite.rs b/cozo-core/src/storage/sqlite.rs index 16f5b013..44343fb7 100644 --- a/cozo-core/src/storage/sqlite.rs +++ b/cozo-core/src/storage/sqlite.rs @@ -108,9 +108,6 @@ impl<'s> Storage<'s> for SqliteStorage { statement.bind((2, &upper_b as &[u8])).unwrap(); while statement.next().unwrap() != State::Done {} }; - #[cfg(feature = "nothread")] - closure(); - #[cfg(not(feature = "nothread"))] std::thread::spawn(closure); Ok(()) } diff --git a/cozo-lib-c/Cargo.toml b/cozo-lib-c/Cargo.toml index cefafe14..85b38dd1 100644 --- a/cozo-lib-c/Cargo.toml +++ b/cozo-lib-c/Cargo.toml @@ -15,9 +15,9 @@ crate-type = ["cdylib", "staticlib"] #! # Features ## Enables the `minimal`, `requests` and `graph-algo` features -compact = ["minimal", "requests", "graph-algo", "rayon"] +compact = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` and `graph-algo` features -mobile = ["storage-sqlite", "graph-algo", "rayon"] +mobile = ["storage-sqlite", "graph-algo"] ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode compact-single-threaded = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` feature @@ -34,10 +34,6 @@ requests = ["cozo/requests"] jemalloc = ["cozo/jemalloc"] ## Enables io-uring option for the RocksDB storage io-uring = ["cozo/io-uring"] -## Allows threading and enables the use of the `rayon` library for parallelizing algorithms -rayon = ["cozo/rayon"] -## Disallows the use of threads -nothread = ["cozo/nothread"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/cozo-lib-java/Cargo.toml b/cozo-lib-java/Cargo.toml index e6bc5854..62848e21 100644 --- a/cozo-lib-java/Cargo.toml +++ b/cozo-lib-java/Cargo.toml @@ -15,9 +15,9 @@ crate-type = ["cdylib"] #! # Features ## Enables the `minimal`, `requests` and `graph-algo` features -compact = ["minimal", "requests", "graph-algo", "rayon"] +compact = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` and `graph-algo` features -mobile = ["storage-sqlite", "graph-algo", "rayon"] +mobile = ["storage-sqlite", "graph-algo"] ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode compact-single-threaded = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` feature @@ -34,10 +34,6 @@ requests = ["cozo/requests"] jemalloc = ["cozo/jemalloc"] ## Enables io-uring option for the RocksDB storage io-uring = ["cozo/io-uring"] -## Allows threading and enables the use of the `rayon` library for parallelizing algorithms -rayon = ["cozo/rayon"] -## Disallows the use of threads -nothread = ["cozo/nothread"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/cozo-lib-nodejs/Cargo.toml b/cozo-lib-nodejs/Cargo.toml index 1b86a7ef..36ea50ab 100644 --- a/cozo-lib-nodejs/Cargo.toml +++ b/cozo-lib-nodejs/Cargo.toml @@ -17,9 +17,9 @@ crate-type = ["cdylib"] #! # Features ## Enables the `minimal`, `requests` and `graph-algo` features -compact = ["minimal", "requests", "graph-algo", "rayon"] +compact = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` and `graph-algo` features -mobile = ["storage-sqlite", "graph-algo", "rayon"] +mobile = ["storage-sqlite", "graph-algo"] ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode compact-single-threaded = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` feature @@ -36,10 +36,6 @@ requests = ["cozo/requests"] jemalloc = ["cozo/jemalloc"] ## Enables io-uring option for the RocksDB storage io-uring = ["cozo/io-uring"] -## Allows threading and enables the use of the `rayon` library for parallelizing algorithms -rayon = ["cozo/rayon"] -## Disallows the use of threads -nothread = ["cozo/nothread"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/cozo-lib-python/Cargo.toml b/cozo-lib-python/Cargo.toml index e0211e32..f93110e7 100644 --- a/cozo-lib-python/Cargo.toml +++ b/cozo-lib-python/Cargo.toml @@ -19,9 +19,9 @@ crate-type = ["cdylib"] #! # Features ## Enables the `minimal`, `requests` and `graph-algo` features -compact = ["minimal", "requests", "graph-algo", "rayon"] +compact = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` and `graph-algo` features -mobile = ["storage-sqlite", "graph-algo", "rayon"] +mobile = ["storage-sqlite", "graph-algo"] ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode compact-single-threaded = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` feature @@ -38,10 +38,6 @@ requests = ["cozo/requests"] jemalloc = ["cozo/jemalloc"] ## Enables io-uring option for the RocksDB storage io-uring = ["cozo/io-uring"] -## Allows threading and enables the use of the `rayon` library for parallelizing algorithms -rayon = ["cozo/rayon"] -## Disallows the use of threads -nothread = ["cozo/nothread"] [dependencies] diff --git a/cozo-lib-swift/Cargo.toml b/cozo-lib-swift/Cargo.toml index b43f3d4e..8dd71ea8 100644 --- a/cozo-lib-swift/Cargo.toml +++ b/cozo-lib-swift/Cargo.toml @@ -16,9 +16,9 @@ crate-type = ["staticlib"] [features] ## Enables the `minimal`, `requests` and `graph-algo` features -compact = ["minimal", "requests", "graph-algo", "rayon"] +compact = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` and `graph-algo` features -mobile = ["storage-sqlite", "graph-algo", "rayon"] +mobile = ["storage-sqlite", "graph-algo"] ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode compact-single-threaded = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` feature @@ -35,10 +35,6 @@ requests = ["cozo/requests"] jemalloc = ["cozo/jemalloc"] ## Enables io-uring option for the RocksDB storage io-uring = ["cozo/io-uring"] -## Allows threading and enables the use of the `rayon` library for parallelizing algorithms -rayon = ["cozo/rayon"] -## Disallows the use of threads -nothread = ["cozo/nothread"] [build-dependencies] swift-bridge-build = "0.1.41" diff --git a/cozo-lib-wasm/Cargo.toml b/cozo-lib-wasm/Cargo.toml index 5dac9155..22ff7f99 100644 --- a/cozo-lib-wasm/Cargo.toml +++ b/cozo-lib-wasm/Cargo.toml @@ -17,7 +17,7 @@ default = ["console_error_panic_hook"] [dependencies] wasm-bindgen = "0.2.63" -cozo = { version = "0.2.1", path = "../cozo-core", default-features = false, features = ["wasm", "nothread"] } +cozo = { version = "0.2.1", path = "../cozo-core", default-features = false, features = ["wasm"] } # The `console_error_panic_hook` crate provides better debugging of panics by # logging them with `console.error`. This is great for development, but requires diff --git a/cozo-lib-wasm/wasm-react-demo/src/App.js b/cozo-lib-wasm/wasm-react-demo/src/App.js index 25f653dc..fde0ef02 100644 --- a/cozo-lib-wasm/wasm-react-demo/src/App.js +++ b/cozo-lib-wasm/wasm-react-demo/src/App.js @@ -225,20 +225,17 @@ function App() { more information about the Cozo database.

Not sure what to run? Click/touch { - setQueryText(`love[loving, loved] <- [['alice', 'eve'], - ['bob', 'alice'], - ['eve', 'alice'], - ['eve', 'bob'], - ['eve', 'charlie'], - ['charlie', 'eve'], - ['david', 'george'], - ['george', 'george']] - -?[person, page_rank] <~ PageRank(love[])`) + setQueryText(`love[loving, loved] <- [['alice', 'eve'], ['bob', 'alice'], + ['eve', 'alice'], ['eve', 'bob'], + ['eve', 'charlie'], ['charlie', 'eve'], + ['david', 'george'], ['george', 'george']] +cls[loving, loved] := love[loving, loved] +cls[loving, loved] := cls[loving, middle], love[middle, loved] +?[loving, loved] := cls[loving, loved]`) }}>HERE ...

... and run the script, to compute the PageRank of + href="https://en.wikipedia.org/wiki/Transitive_closure">transitive closure of a hypothetical love triangle.

diff --git a/cozoserver/Cargo.toml b/cozoserver/Cargo.toml index 8915f8ed..3fbe4662 100644 --- a/cozoserver/Cargo.toml +++ b/cozoserver/Cargo.toml @@ -15,9 +15,9 @@ documentation = "https://cozodb.github.io/current/manual" #! # Features ## Enables the `minimal`, `requests` and `graph-algo` features -compact = ["minimal", "requests", "graph-algo", "rayon"] +compact = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` and `graph-algo` features -mobile = ["storage-sqlite", "graph-algo", "rayon"] +mobile = ["storage-sqlite", "graph-algo"] ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode compact-single-threaded = ["minimal", "requests", "graph-algo"] ## Enables the `storage-sqlite` feature @@ -34,10 +34,6 @@ requests = ["cozo/requests"] jemalloc = ["cozo/jemalloc"] ## Enables io-uring option for the RocksDB storage io-uring = ["cozo/io-uring"] -## Allows threading and enables the use of the `rayon` library for parallelizing algorithms -rayon = ["cozo/rayon"] -## Disallows the use of threads -nothread = ["cozo/nothread"] ## Enables the [Sled](https://github.com/spacejam/sled) backend storage-sled = ["cozo/storage-sled"] ## Enables the [TiKV](https://tikv.org/) client backend