make everything compile again

main
Ziyang Hu 2 years ago
parent 3b29579c48
commit d1349955b1

@ -17,7 +17,7 @@ exclude = [
default = ["compact"] default = ["compact"]
## Enables the `minimal`, `requests` and `graph-algo` features. ## 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. ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode.
compact-single-threaded = ["minimal", "requests", "graph-algo"] compact-single-threaded = ["minimal", "requests", "graph-algo"]
## Enables the `storage-sqlite` feature. ## 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. ## You can also [fine-tune](https://github.com/cozodb/cozo/blob/main/TUNING_ROCKSDB.md) RocksDB options.
storage-rocksdb = ["dep:cozorocks"] storage-rocksdb = ["dep:cozorocks"]
## Enables the graph algorithms. ## Enables the graph algorithms.
graph-algo = [] graph-algo = ["graph", "rayon"]
## Allows the utilities to make web requests to fetch data. ## Allows the utilities to make web requests to fetch data.
requests = ["dep:minreq"] requests = ["dep:minreq"]
## Uses jemalloc as the global allocator, can make a difference in performance. ## 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"] io-uring = ["cozorocks?/io-uring"]
## Polyfills for the WASM target ## Polyfills for the WASM target
wasm = ["uuid/js", "dep:js-sys"] 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: #! The following features are highly experimental:
@ -67,12 +63,6 @@ storage-tikv = ["dep:tikv-client", "dep:tokio"]
#! (utilities are still available), #! (utilities are still available),
#! which could be OK if you only want to deal with pure Datalog. #! 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 #! The `requests` feature allows the database to make outgoing HTTP requests to fetch data
#! into queries -- only enable it if you need it. #! into queries -- only enable it if you need it.
#! #!

@ -13,7 +13,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
use chrono::{DateTime, TimeZone, Utc}; use chrono::{DateTime, TimeZone, Utc};
use itertools::Itertools; use itertools::Itertools;
#[cfg(feature = "wasm")] #[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
use js_sys::Date; use js_sys::Date;
use miette::{bail, ensure, miette, Result}; use miette::{bail, ensure, miette, Result};
use num_traits::FloatConst; use num_traits::FloatConst;
@ -1462,12 +1462,12 @@ pub(crate) fn op_to_uuid(args: &[DataValue]) -> Result<DataValue> {
} }
define_op!(OP_NOW, 0, false); 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<DataValue> { pub(crate) fn op_now(_args: &[DataValue]) -> Result<DataValue> {
let d: f64 = Date::now() / 1000.; let d: f64 = Date::now() / 1000.;
Ok(DataValue::from(d)) 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<DataValue> { pub(crate) fn op_now(_args: &[DataValue]) -> Result<DataValue> {
let now = SystemTime::now(); let now = SystemTime::now();
Ok(DataValue::from( Ok(DataValue::from(
@ -1477,12 +1477,12 @@ pub(crate) fn op_now(_args: &[DataValue]) -> Result<DataValue> {
define_op!(OP_FORMAT_TIMESTAMP, 1, true); define_op!(OP_FORMAT_TIMESTAMP, 1, true);
pub(crate) fn op_format_timestamp(args: &[DataValue]) -> Result<DataValue> { pub(crate) fn op_format_timestamp(args: &[DataValue]) -> Result<DataValue> {
#[cfg(feature = "wasm")] #[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
let dt = Utc let dt = Utc
.timestamp_millis_opt(Date::now() as i64) .timestamp_millis_opt(Date::now() as i64)
.latest() .latest()
.ok_or_else(|| miette!("bad time input"))?; .ok_or_else(|| miette!("bad time input"))?;
#[cfg(not(feature = "wasm"))] #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
let dt = { let dt = {
let f = args[0] let f = args[0]
.get_float() .get_float()
@ -1526,14 +1526,14 @@ define_op!(OP_RAND_UUID_V1, 0, false);
pub(crate) fn op_rand_uuid_v1(_args: &[DataValue]) -> Result<DataValue> { pub(crate) fn op_rand_uuid_v1(_args: &[DataValue]) -> Result<DataValue> {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
let uuid_ctx = uuid::v1::Context::new(rng.gen()); let uuid_ctx = uuid::v1::Context::new(rng.gen());
#[cfg(feature = "wasm")] #[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
let ts = { let ts = {
let since_epoch: f64 = Date::now(); let since_epoch: f64 = Date::now();
let seconds = since_epoch.floor(); let seconds = since_epoch.floor();
let fractional = (since_epoch - seconds) * 1.0e9; let fractional = (since_epoch - seconds) * 1.0e9;
Timestamp::from_unix(uuid_ctx, seconds as u64, fractional as u32) 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 ts = {
let now = SystemTime::now(); let now = SystemTime::now();
let since_epoch = now.duration_since(UNIX_EPOCH).unwrap(); let since_epoch = now.duration_since(UNIX_EPOCH).unwrap();

@ -6,34 +6,38 @@
* You can obtain one at https://mozilla.org/MPL/2.0/. * You can obtain one at https://mozilla.org/MPL/2.0/.
*/ */
#[cfg(feature = "graph-algo")]
pub(crate) mod all_pairs_shortest_path; pub(crate) mod all_pairs_shortest_path;
#[cfg(feature = "graph-algo")]
pub(crate) mod astar; pub(crate) mod astar;
#[cfg(feature = "graph-algo")]
pub(crate) mod bfs; pub(crate) mod bfs;
#[cfg(feature = "graph-algo")]
pub(crate) mod degree_centrality; pub(crate) mod degree_centrality;
#[cfg(feature = "graph-algo")]
pub(crate) mod dfs; pub(crate) mod dfs;
#[cfg(feature = "graph-algo")]
pub(crate) mod kruskal; pub(crate) mod kruskal;
#[cfg(feature = "graph-algo")]
pub(crate) mod label_propagation; pub(crate) mod label_propagation;
#[cfg(feature = "graph-algo")]
pub(crate) mod louvain; pub(crate) mod louvain;
#[cfg(feature = "graph-algo")]
pub(crate) mod pagerank; pub(crate) mod pagerank;
#[cfg(feature = "graph-algo")]
pub(crate) mod prim; pub(crate) mod prim;
#[cfg(feature = "graph-algo")]
pub(crate) mod shortest_path_dijkstra; pub(crate) mod shortest_path_dijkstra;
pub(crate) mod strongly_connected_components; pub(crate) mod strongly_connected_components;
#[cfg(feature = "graph-algo")]
pub(crate) mod top_sort; pub(crate) mod top_sort;
#[cfg(feature = "graph-algo")]
pub(crate) mod triangles; pub(crate) mod triangles;
#[cfg(feature = "graph-algo")]
pub(crate) mod yen; pub(crate) mod yen;
#[cfg(feature = "graph-algo")]
pub(crate) mod shortest_path_bfs; 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;

@ -9,9 +9,12 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::sync::Arc; use std::sync::Arc;
#[allow(unused_imports)]
use either::{Left, Right}; use either::{Left, Right};
#[cfg(feature = "graph-algo")]
use graph::prelude::{CsrLayout, DirectedCsrGraph, GraphBuilder}; use graph::prelude::{CsrLayout, DirectedCsrGraph, GraphBuilder};
use lazy_static::lazy_static; use lazy_static::lazy_static;
#[allow(unused_imports)]
use miette::{bail, ensure, Diagnostic, Report, Result}; use miette::{bail, ensure, Diagnostic, Report, Result};
use smartstring::{LazyCompact, SmartString}; use smartstring::{LazyCompact, SmartString};
use thiserror::Error; use thiserror::Error;
@ -25,49 +28,14 @@ use crate::data::symb::Symbol;
use crate::data::tuple::TupleIter; use crate::data::tuple::TupleIter;
use crate::data::value::DataValue; use crate::data::value::DataValue;
#[cfg(feature = "graph-algo")] #[cfg(feature = "graph-algo")]
use crate::fixed_rule::algos::all_pairs_shortest_path::{ use crate::fixed_rule::algos::*;
BetweennessCentrality, ClosenessCentrality, use crate::fixed_rule::utilities::*;
};
#[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::parse::SourceSpan; use crate::parse::SourceSpan;
use crate::runtime::db::Poison; use crate::runtime::db::Poison;
use crate::runtime::temp_store::{EpochStore, RegularTempStore}; use crate::runtime::temp_store::{EpochStore, RegularTempStore};
use crate::runtime::transact::SessionTx; use crate::runtime::transact::SessionTx;
#[cfg(feature = "graph-algo")]
pub(crate) mod algos; pub(crate) mod algos;
pub(crate) mod utilities; pub(crate) mod utilities;
@ -138,6 +106,7 @@ impl<'a, 'b> FixedRuleInputRelation<'a, 'b> {
pub fn span(&self) -> SourceSpan { pub fn span(&self) -> SourceSpan {
self.arg_manifest.span() self.arg_manifest.span()
} }
#[cfg(feature = "graph-algo")]
pub fn to_directed_graph( pub fn to_directed_graph(
&self, &self,
undirected: bool, undirected: bool,
@ -203,7 +172,7 @@ impl<'a, 'b> FixedRuleInputRelation<'a, 'b> {
} }
Ok((graph, indices, inv_indices)) Ok((graph, indices, inv_indices))
} }
#[cfg(feature = "graph-algo")]
pub fn to_directed_weighted_graph( pub fn to_directed_weighted_graph(
&self, &self,
undirected: bool, undirected: bool,

@ -9,5 +9,9 @@
pub(crate) mod constant; pub(crate) mod constant;
pub(crate) mod csv; pub(crate) mod csv;
pub(crate) mod jlines; pub(crate) mod jlines;
pub(crate) mod random_walk;
pub(crate) mod reorder_sort; 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;

@ -177,17 +177,17 @@ impl DbInstance {
payload: &str, payload: &str,
params: BTreeMap<String, JsonValue>, params: BTreeMap<String, JsonValue>,
) -> JsonValue { ) -> JsonValue {
#[cfg(not(feature = "wasm"))] #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
let start = Instant::now(); let start = Instant::now();
match self.run_script(payload, params) { match self.run_script(payload, params) {
Ok(named_rows) => { Ok(named_rows) => {
let mut j_val = named_rows.into_json(); 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 took = start.elapsed().as_secs_f64();
let map = j_val.as_object_mut().unwrap(); let map = j_val.as_object_mut().unwrap();
map.insert("ok".to_string(), json!(true)); 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)); map.insert("took".to_string(), json!(took));
j_val j_val

@ -238,9 +238,10 @@ pub(crate) fn parse_query(
out_opts.timeout = Some(timeout); out_opts.timeout = Some(timeout);
} }
Rule::sleep_option => { Rule::sleep_option => {
#[cfg(feature = "wasm")] #[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
bail!(":sleep is not supported under WASM"); 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 pair = pair.into_inner().next().unwrap();
let span = pair.extract_span(); let span = pair.extract_span();

@ -507,7 +507,7 @@ impl<'s, S: Storage<'s>> Db<S> {
let (q_res, q_cleanups) = self.run_query(&mut tx, p)?; let (q_res, q_cleanups) = self.run_query(&mut tx, p)?;
res = q_res; res = q_res;
cleanups.extend(q_cleanups); cleanups.extend(q_cleanups);
#[cfg(not(feature = "wasm"))] #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
if let Some(secs) = sleep_opt { if let Some(secs) = sleep_opt {
thread::sleep(Duration::from_micros((secs * 1000000.) as u64)); thread::sleep(Duration::from_micros((secs * 1000000.) as u64));
} }
@ -867,15 +867,15 @@ impl<'s, S: Storage<'s>> Db<S> {
let id = self.queries_count.fetch_add(1, Ordering::AcqRel); let id = self.queries_count.fetch_add(1, Ordering::AcqRel);
// time the query // time the query
#[cfg(not(feature = "wasm"))] #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
let now = SystemTime::now(); let now = SystemTime::now();
#[cfg(not(feature = "wasm"))] #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
let since_the_epoch = now let since_the_epoch = now
.duration_since(UNIX_EPOCH) .duration_since(UNIX_EPOCH)
.into_diagnostic()? .into_diagnostic()?
.as_secs_f64(); .as_secs_f64();
#[cfg(feature = "wasm")] #[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
let since_the_epoch = js_sys::Date::now(); let since_the_epoch = js_sys::Date::now();
let handle = RunningQueryHandle { let handle = RunningQueryHandle {
@ -1151,11 +1151,11 @@ impl Poison {
} }
Ok(()) Ok(())
} }
#[cfg(feature = "nothread")] #[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
pub(crate) fn set_timeout(&self, _secs: f64) -> Result<()> { pub(crate) fn set_timeout(&self, _secs: f64) -> Result<()> {
bail!("Cannot set timeout when threading is disallowed"); 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<()> { pub(crate) fn set_timeout(&self, secs: f64) -> Result<()> {
let pill = self.clone(); let pill = self.clone();
thread::spawn(move || { thread::spawn(move || {

@ -67,9 +67,9 @@ impl<'s> Storage<'s> for MemStorage {
wtr.remove(k); wtr.remove(k);
} }
}; };
#[cfg(feature = "nothread")] #[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
closure(); closure();
#[cfg(not(feature = "nothread"))] #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
std::thread::spawn(closure); std::thread::spawn(closure);
Ok(()) Ok(())
} }

@ -108,9 +108,6 @@ impl<'s> Storage<'s> for SqliteStorage {
statement.bind((2, &upper_b as &[u8])).unwrap(); statement.bind((2, &upper_b as &[u8])).unwrap();
while statement.next().unwrap() != State::Done {} while statement.next().unwrap() != State::Done {}
}; };
#[cfg(feature = "nothread")]
closure();
#[cfg(not(feature = "nothread"))]
std::thread::spawn(closure); std::thread::spawn(closure);
Ok(()) Ok(())
} }

@ -15,9 +15,9 @@ crate-type = ["cdylib", "staticlib"]
#! # Features #! # Features
## Enables the `minimal`, `requests` and `graph-algo` 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 ## 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 ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode
compact-single-threaded = ["minimal", "requests", "graph-algo"] compact-single-threaded = ["minimal", "requests", "graph-algo"]
## Enables the `storage-sqlite` feature ## Enables the `storage-sqlite` feature
@ -34,10 +34,6 @@ requests = ["cozo/requests"]
jemalloc = ["cozo/jemalloc"] jemalloc = ["cozo/jemalloc"]
## Enables io-uring option for the RocksDB storage ## Enables io-uring option for the RocksDB storage
io-uring = ["cozo/io-uring"] 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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

@ -15,9 +15,9 @@ crate-type = ["cdylib"]
#! # Features #! # Features
## Enables the `minimal`, `requests` and `graph-algo` 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 ## 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 ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode
compact-single-threaded = ["minimal", "requests", "graph-algo"] compact-single-threaded = ["minimal", "requests", "graph-algo"]
## Enables the `storage-sqlite` feature ## Enables the `storage-sqlite` feature
@ -34,10 +34,6 @@ requests = ["cozo/requests"]
jemalloc = ["cozo/jemalloc"] jemalloc = ["cozo/jemalloc"]
## Enables io-uring option for the RocksDB storage ## Enables io-uring option for the RocksDB storage
io-uring = ["cozo/io-uring"] 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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

@ -17,9 +17,9 @@ crate-type = ["cdylib"]
#! # Features #! # Features
## Enables the `minimal`, `requests` and `graph-algo` 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 ## 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 ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode
compact-single-threaded = ["minimal", "requests", "graph-algo"] compact-single-threaded = ["minimal", "requests", "graph-algo"]
## Enables the `storage-sqlite` feature ## Enables the `storage-sqlite` feature
@ -36,10 +36,6 @@ requests = ["cozo/requests"]
jemalloc = ["cozo/jemalloc"] jemalloc = ["cozo/jemalloc"]
## Enables io-uring option for the RocksDB storage ## Enables io-uring option for the RocksDB storage
io-uring = ["cozo/io-uring"] 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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

@ -19,9 +19,9 @@ crate-type = ["cdylib"]
#! # Features #! # Features
## Enables the `minimal`, `requests` and `graph-algo` 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 ## 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 ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode
compact-single-threaded = ["minimal", "requests", "graph-algo"] compact-single-threaded = ["minimal", "requests", "graph-algo"]
## Enables the `storage-sqlite` feature ## Enables the `storage-sqlite` feature
@ -38,10 +38,6 @@ requests = ["cozo/requests"]
jemalloc = ["cozo/jemalloc"] jemalloc = ["cozo/jemalloc"]
## Enables io-uring option for the RocksDB storage ## Enables io-uring option for the RocksDB storage
io-uring = ["cozo/io-uring"] 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] [dependencies]

@ -16,9 +16,9 @@ crate-type = ["staticlib"]
[features] [features]
## Enables the `minimal`, `requests` and `graph-algo` 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 ## 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 ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode
compact-single-threaded = ["minimal", "requests", "graph-algo"] compact-single-threaded = ["minimal", "requests", "graph-algo"]
## Enables the `storage-sqlite` feature ## Enables the `storage-sqlite` feature
@ -35,10 +35,6 @@ requests = ["cozo/requests"]
jemalloc = ["cozo/jemalloc"] jemalloc = ["cozo/jemalloc"]
## Enables io-uring option for the RocksDB storage ## Enables io-uring option for the RocksDB storage
io-uring = ["cozo/io-uring"] 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] [build-dependencies]
swift-bridge-build = "0.1.41" swift-bridge-build = "0.1.41"

@ -17,7 +17,7 @@ default = ["console_error_panic_hook"]
[dependencies] [dependencies]
wasm-bindgen = "0.2.63" 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 # The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires # logging them with `console.error`. This is great for development, but requires

@ -225,20 +225,17 @@ function App() {
more information about the Cozo database. more information about the Cozo database.
</p> </p>
<h2>Not sure what to run? Click/touch <a onClick={() => { <h2>Not sure what to run? Click/touch <a onClick={() => {
setQueryText(`love[loving, loved] <- [['alice', 'eve'], setQueryText(`love[loving, loved] <- [['alice', 'eve'], ['bob', 'alice'],
['bob', 'alice'], ['eve', 'alice'], ['eve', 'bob'],
['eve', 'alice'], ['eve', 'charlie'], ['charlie', 'eve'],
['eve', 'bob'], ['david', 'george'], ['george', 'george']]
['eve', 'charlie'], cls[loving, loved] := love[loving, loved]
['charlie', 'eve'], cls[loving, loved] := cls[loving, middle], love[middle, loved]
['david', 'george'], ?[loving, loved] := cls[loving, loved]`)
['george', 'george']]
?[person, page_rank] <~ PageRank(love[])`)
}}>HERE</a> ...</h2> }}>HERE</a> ...</h2>
<p> <p>
... and run the script, to compute the <a ... and run the script, to compute the <a
href="https://www.wikiwand.com/en/PageRank">PageRank</a> of href="https://en.wikipedia.org/wiki/Transitive_closure">transitive closure</a> of
a hypothetical love triangle. a hypothetical love triangle.
</p> </p>
<p> <p>

@ -15,9 +15,9 @@ documentation = "https://cozodb.github.io/current/manual"
#! # Features #! # Features
## Enables the `minimal`, `requests` and `graph-algo` 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 ## 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 ## Enables the `minimal`, `requests` and `graph-algo` features in single threaded mode
compact-single-threaded = ["minimal", "requests", "graph-algo"] compact-single-threaded = ["minimal", "requests", "graph-algo"]
## Enables the `storage-sqlite` feature ## Enables the `storage-sqlite` feature
@ -34,10 +34,6 @@ requests = ["cozo/requests"]
jemalloc = ["cozo/jemalloc"] jemalloc = ["cozo/jemalloc"]
## Enables io-uring option for the RocksDB storage ## Enables io-uring option for the RocksDB storage
io-uring = ["cozo/io-uring"] 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 ## Enables the [Sled](https://github.com/spacejam/sled) backend
storage-sled = ["cozo/storage-sled"] storage-sled = ["cozo/storage-sled"]
## Enables the [TiKV](https://tikv.org/) client backend ## Enables the [TiKV](https://tikv.org/) client backend

Loading…
Cancel
Save