diff --git a/Cargo.lock b/Cargo.lock index 77d9df5e..0fc506a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,200 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "actix-codec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a7559404a7f3573127aab53c08ce37a6c6a315c374a31070f3c91cd1b4a7fe" -dependencies = [ - "bitflags", - "bytes", - "futures-core", - "futures-sink", - "log", - "memchr", - "pin-project-lite", - "tokio", - "tokio-util", -] - -[[package]] -name = "actix-cors" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684a6ce1562a5fcca49bc9302896c63547eea78a1e405e837e7416affd8b6eb9" -dependencies = [ - "actix-utils", - "actix-web", - "derive_more", - "futures-util", - "log", - "once_cell", - "smallvec", -] - -[[package]] -name = "actix-http" -version = "3.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c83abf9903e1f0ad9973cc4f7b9767fd5a03a583f51a5b7a339e07987cd2724" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "ahash", - "base64", - "bitflags", - "brotli", - "bytes", - "bytestring", - "derive_more", - "encoding_rs", - "flate2", - "futures-core", - "h2", - "http", - "httparse", - "httpdate", - "itoa 1.0.4", - "language-tags", - "local-channel", - "mime", - "percent-encoding", - "pin-project-lite", - "rand", - "sha1", - "smallvec", - "tracing", - "zstd", -] - -[[package]] -name = "actix-macros" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "actix-router" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" -dependencies = [ - "bytestring", - "http", - "regex", - "serde", - "tracing", -] - -[[package]] -name = "actix-rt" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000" -dependencies = [ - "futures-core", - "tokio", -] - -[[package]] -name = "actix-server" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da34f8e659ea1b077bb4637948b815cd3768ad5a188fdcd74ff4d84240cd824" -dependencies = [ - "actix-rt", - "actix-service", - "actix-utils", - "futures-core", - "futures-util", - "mio", - "num_cpus", - "socket2", - "tokio", - "tracing", -] - -[[package]] -name = "actix-service" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b894941f818cfdc7ccc4b9e60fa7e53b5042a2e8567270f9147d5591893373a" -dependencies = [ - "futures-core", - "paste", - "pin-project-lite", -] - -[[package]] -name = "actix-utils" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e491cbaac2e7fc788dfff99ff48ef317e23b3cf63dbaf7aaab6418f40f92aa94" -dependencies = [ - "local-waker", - "pin-project-lite", -] - -[[package]] -name = "actix-web" -version = "4.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48f7b6534e06c7bfc72ee91db7917d4af6afe23e7d223b51e68fffbb21e96b9" -dependencies = [ - "actix-codec", - "actix-http", - "actix-macros", - "actix-router", - "actix-rt", - "actix-server", - "actix-service", - "actix-utils", - "actix-web-codegen", - "ahash", - "bytes", - "bytestring", - "cfg-if", - "cookie", - "derive_more", - "encoding_rs", - "futures-core", - "futures-util", - "http", - "itoa 1.0.4", - "language-tags", - "log", - "mime", - "once_cell", - "pin-project-lite", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "smallvec", - "socket2", - "time 0.3.15", - "url", -] - -[[package]] -name = "actix-web-codegen" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa9362663c8643d67b2d5eafba49e4cb2c8a053a29ed00a0bea121f17c76b13" -dependencies = [ - "actix-router", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "addr2line" version = "0.17.0" @@ -211,6 +17,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" + [[package]] name = "ahash" version = "0.7.6" @@ -265,16 +77,10 @@ dependencies = [ ] [[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" +name = "ascii" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" [[package]] name = "atomic" @@ -329,17 +135,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "blake2b_simd" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72936ee4afc7f8f736d1c38383b56480b5497b4617b4a77bdbf1d2ababc76127" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq", -] - [[package]] name = "block-buffer" version = "0.10.3" @@ -382,6 +177,16 @@ dependencies = [ "serde", ] +[[package]] +name = "buf_redux" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" +dependencies = [ + "memchr", + "safemem", +] + [[package]] name = "bumpalo" version = "3.11.0" @@ -400,21 +205,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" - -[[package]] -name = "bytestring" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b6a75fd3048808ef06af5cd79712be8111960adaf89d90250974b38fc3928a" -dependencies = [ - "bytes", -] - [[package]] name = "casey" version = "0.3.3" @@ -429,15 +219,6 @@ name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" [[package]] name = "cfg-if" @@ -492,6 +273,12 @@ dependencies = [ "phf_codegen", ] +[[package]] +name = "chunked_transfer" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" + [[package]] name = "clap" version = "3.2.22" @@ -541,39 +328,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "combine" -version = "4.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "cookie" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "344adc371239ef32293cb1c4fe519592fcf21206c79c02854320afcdf3ab4917" -dependencies = [ - "percent-encoding", - "time 0.3.15", - "version_check", -] - [[package]] name = "core-foundation" version = "0.9.3" @@ -607,6 +361,7 @@ dependencies = [ "lazy_static", "log", "miette", + "minreq", "nalgebra", "num-traits", "ordered-float", @@ -616,7 +371,6 @@ dependencies = [ "rand", "rayon", "regex", - "reqwest", "rmp", "rmp-serde", "rmpv", @@ -644,23 +398,17 @@ dependencies = [ name = "cozoserver" version = "0.1.0" dependencies = [ - "actix-cors", - "actix-web", "clap", "cozo", "env_logger", - "futures", "log", "miette", - "rand", + "rouille", "rpassword", - "rust-argon2", "serde", "serde_derive", "serde_json", - "sha3", "static-files", - "webbrowser", ] [[package]] @@ -756,12 +504,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "cty" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" - [[package]] name = "cxx" version = "1.0.78" @@ -807,51 +549,13 @@ dependencies = [ ] [[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" +name = "deflate" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "5f95bf05dffba6e6cce8dfbb30def788154949ccd9aed761b472119c21e01c70" dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn", + "adler32", + "gzip-header", ] [[package]] @@ -870,15 +574,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" -[[package]] -name = "encoding_rs" -version = "0.8.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" -dependencies = [ - "cfg-if", -] - [[package]] name = "env_logger" version = "0.9.1" @@ -902,21 +597,17 @@ dependencies = [ ] [[package]] -name = "flate2" -version = "1.0.24" +name = "filetime" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" dependencies = [ - "crc32fast", - "miniz_oxide", + "cfg-if", + "libc", + "redox_syscall", + "windows-sys", ] -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "foreign-types" version = "0.3.2" @@ -941,95 +632,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "futures" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" - -[[package]] -name = "futures-executor" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" - -[[package]] -name = "futures-macro" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" - -[[package]] -name = "futures-task" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" - -[[package]] -name = "futures-util" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "generic-array" version = "0.14.6" @@ -1064,22 +666,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] -name = "h2" -version = "0.3.14" +name = "gzip-header" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "0131feb3d3bb2a5a238d8a4d09f6353b7ebfdc52e77bccbf4ea6eaa751dde639" dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", + "crc32fast", ] [[package]] @@ -1106,83 +698,18 @@ dependencies = [ "libc", ] -[[package]] -name = "http" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" -dependencies = [ - "bytes", - "fnv", - "itoa 1.0.4", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - [[package]] name = "httparse" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" -[[package]] -name = "hyper" -version = "0.14.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa 1.0.4", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "iana-time-zone" version = "0.1.50" @@ -1196,12 +723,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.3.0" @@ -1231,12 +752,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "ipnet" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" - [[package]] name = "is_ci" version = "1.1.1" @@ -1264,35 +779,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" -[[package]] -name = "jni" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "jobserver" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.60" @@ -1302,18 +788,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "language-tags" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" - [[package]] name = "lazy_static" version = "1.4.0" @@ -1335,34 +809,6 @@ dependencies = [ "cc", ] -[[package]] -name = "local-channel" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f303ec0e94c6c54447f84f3b0ef7af769858a9c4ef56ef2a986d3dcd4c3fc9c" -dependencies = [ - "futures-core", - "futures-sink", - "futures-util", - "local-waker", -] - -[[package]] -name = "local-waker" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34f76eb3611940e0e7d53a9aaa4e6a3151f69541a282fd0dad5571420c53ff1" - -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - [[package]] name = "log" version = "0.4.17" @@ -1372,15 +818,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - [[package]] name = "matrixmultiply" version = "0.3.2" @@ -1462,15 +899,31 @@ dependencies = [ ] [[package]] -name = "mio" -version = "0.8.4" +name = "minreq" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "4c785bc6027fd359756e538541c8624012ba3776d3d3fe123885643092ed4132" dependencies = [ - "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "native-tls", +] + +[[package]] +name = "multipart" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182" +dependencies = [ + "buf_redux", + "httparse", + "log", + "mime", + "mime_guess", + "quick-error", + "rand", + "safemem", + "tempfile", + "twoway", ] [[package]] @@ -1518,64 +971,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "ndk" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" -dependencies = [ - "bitflags", - "jni-sys", - "ndk-sys", - "num_enum", - "raw-window-handle", - "thiserror", -] - -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - -[[package]] -name = "ndk-glue" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" -dependencies = [ - "libc", - "log", - "ndk", - "ndk-context", - "ndk-macro", - "ndk-sys", - "once_cell", - "parking_lot", -] - -[[package]] -name = "ndk-macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" -dependencies = [ - "darling", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ndk-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21d83ec9c63ec5bf950200a8e508bdad6659972187b625469f58ef8c08e29046" -dependencies = [ - "jni-sys", -] - [[package]] name = "num-complex" version = "0.4.2" @@ -1619,31 +1014,10 @@ dependencies = [ name = "num_cpus" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "num_enum" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", ] [[package]] @@ -1655,15 +1029,6 @@ dependencies = [ "libc", ] -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", -] - [[package]] name = "object" version = "0.29.0" @@ -1745,29 +1110,6 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys", -] - [[package]] name = "parse-zoneinfo" version = "0.3.0" @@ -1845,7 +1187,7 @@ checksum = "4c8717927f9b79515e565a64fe46c38b8cd0427e64c40680b14a7365ab09ac8d" dependencies = [ "once_cell", "pest", - "sha1", + "sha1 0.10.5", ] [[package]] @@ -1887,18 +1229,6 @@ dependencies = [ "uncased", ] -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - [[package]] name = "pkg-config" version = "0.3.25" @@ -1921,17 +1251,6 @@ dependencies = [ "indexmap", ] -[[package]] -name = "proc-macro-crate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" -dependencies = [ - "once_cell", - "thiserror", - "toml", -] - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -1965,6 +1284,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quote" version = "1.0.21" @@ -2004,15 +1329,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "raw-window-handle" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a" -dependencies = [ - "cty", -] - [[package]] name = "rawpointer" version = "0.2.1" @@ -2084,43 +1400,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "reqwest" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - [[package]] name = "rmp" version = "0.8.11" @@ -2154,25 +1433,38 @@ dependencies = [ ] [[package]] -name = "rpassword" -version = "7.0.0" +name = "rouille" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b763cb66df1c928432cc35053f8bd4cec3335d8559fc16010017d16b3c1680" +checksum = "18b2380c42510ef4a28b5f228a174c801e0dec590103e215e60812e2e2f34d05" dependencies = [ - "libc", - "winapi", + "base64", + "brotli", + "chrono", + "deflate", + "filetime", + "multipart", + "num_cpus", + "percent-encoding", + "rand", + "serde", + "serde_derive", + "serde_json", + "sha1 0.6.1", + "threadpool", + "time 0.3.15", + "tiny_http", + "url", ] [[package]] -name = "rust-argon2" -version = "1.0.0" +name = "rpassword" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b50162d19404029c1ceca6f6980fe40d45c8b369f6f44446fa14bb39573b5bb9" +checksum = "26b763cb66df1c928432cc35053f8bd4cec3335d8559fc16010017d16b3c1680" dependencies = [ - "base64", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils", + "libc", + "winapi", ] [[package]] @@ -2181,15 +1473,6 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - [[package]] name = "ryu" version = "1.0.11" @@ -2206,13 +1489,10 @@ dependencies = [ ] [[package]] -name = "same-file" -version = "1.0.6" +name = "safemem" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" [[package]] name = "schannel" @@ -2259,12 +1539,6 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" - [[package]] name = "serde" version = "1.0.145" @@ -2303,15 +1577,12 @@ dependencies = [ ] [[package]] -name = "serde_urlencoded" -version = "0.7.1" +name = "sha1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" dependencies = [ - "form_urlencoded", - "itoa 1.0.4", - "ryu", - "serde", + "sha1_smol", ] [[package]] @@ -2326,23 +1597,10 @@ dependencies = [ ] [[package]] -name = "sha3" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2904bea16a1ae962b483322a1c7b81d976029203aea1f461e51cd7705db7ba9" -dependencies = [ - "digest", - "keccak", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.0" +name = "sha1_smol" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" [[package]] name = "simba" @@ -2363,15 +1621,6 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" -[[package]] -name = "slab" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" -dependencies = [ - "autocfg", -] - [[package]] name = "smallvec" version = "1.10.0" @@ -2399,16 +1648,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" -[[package]] -name = "socket2" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "static-files" version = "0.2.3" @@ -2535,6 +1774,15 @@ dependencies = [ "syn", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" version = "0.1.44" @@ -2552,17 +1800,22 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c" dependencies = [ - "itoa 1.0.4", "libc", "num_threads", - "time-macros", ] [[package]] -name = "time-macros" -version = "0.2.4" +name = "tiny_http" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" +checksum = "9ce51b50006056f590c9b7c3808c3bd70f0d1101666629713866c227d6e58d39" +dependencies = [ + "ascii", + "chrono", + "chunked_transfer", + "log", + "url", +] [[package]] name = "tinyvec" @@ -2580,90 +1833,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] -name = "tokio" -version = "1.21.2" +name = "twoway" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" dependencies = [ - "autocfg", - "bytes", - "libc", "memchr", - "mio", - "num_cpus", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "winapi", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "log", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" -dependencies = [ - "once_cell", ] -[[package]] -name = "try-lock" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" - [[package]] name = "typenum" version = "1.15.0" @@ -2765,27 +1942,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "walkdir" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -dependencies = [ - "same-file", - "winapi", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -2823,18 +1979,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.83" @@ -2864,32 +2008,6 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" -[[package]] -name = "web-sys" -version = "0.3.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webbrowser" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d62aa75495ab67cdc273d0b95cc76bcedfea2ba28338a4cf9b4137949dfac5" -dependencies = [ - "jni", - "ndk-glue", - "objc", - "raw-window-handle", - "url", - "web-sys", - "widestring", - "winapi", -] - [[package]] name = "wide" version = "0.7.5" @@ -2900,12 +2018,6 @@ dependencies = [ "safe_arch", ] -[[package]] -name = "widestring" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" - [[package]] name = "winapi" version = "0.3.9" @@ -2979,41 +2091,3 @@ name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" -dependencies = [ - "cc", - "libc", -] diff --git a/Cargo.toml b/Cargo.toml index be360641..5eafe8f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ pest = "2.2.1" pest_derive = "2.2.1" rayon = "1.5.3" nalgebra = "0.31.1" -reqwest = { version = "0.11.11", features = ["blocking"] } +minreq = { version = "2.6.0", features = ["https-native"] } approx = "0.5.1" unicode-normalization = "0.1.21" thiserror = "1.0.34" diff --git a/cozoserver/Cargo.toml b/cozoserver/Cargo.toml index a671e82b..b240497e 100644 --- a/cozoserver/Cargo.toml +++ b/cozoserver/Cargo.toml @@ -7,21 +7,15 @@ license = "AGPL-3.0-or-later" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -actix-web = "4.1.0" clap = { version = "3.2.8", features = ["derive"] } -actix-cors = "0.6.1" log = "0.4.16" miette = { version = "5.3.0", features = ["fancy"] } env_logger = "0.9.0" serde = "1.0.144" serde_json = "1.0.81" serde_derive = "1.0.144" -rust-argon2 = "1.0.0" -sha3 = "0.10.4" -rand = "0.8.5" rpassword = "7.0.0" -webbrowser = "0.8.0" -futures = "0.3.24" +rouille = "3.5.0" cozo = { path = ".." } [build-dependencies] diff --git a/cozoserver/src/main.rs b/cozoserver/src/main.rs index b0d1adf0..db81b54e 100644 --- a/cozoserver/src/main.rs +++ b/cozoserver/src/main.rs @@ -1,58 +1,14 @@ -use std::collections::{BTreeMap, HashMap}; -use std::env; -use std::fmt::{Debug, Display, Formatter}; -use std::io::{stdin, stdout, Write}; -use std::str::from_utf8; -use std::sync::{Arc, RwLock}; +use std::collections::BTreeMap; +use std::fmt::Debug; use std::time::Instant; -use actix_cors::Cors; -use actix_web::{App, HttpRequest, HttpResponse, HttpServer, post, Responder, ResponseError, web}; -use actix_web::body::BoxBody; -use actix_web::http::header::HeaderName; -use actix_web::middleware::Logger; -use actix_web::rt::task::spawn_blocking; use clap::Parser; use env_logger::Env; -use log::debug; -use miette::{bail, IntoDiagnostic, miette}; -use rand::Rng; +use rouille::{router, try_or_400, Response}; use serde_json::json; -use sha3::Digest; use cozo::{Db, DbBuilder}; -type Result = std::result::Result; - -struct RespError { - err: miette::Error, -} - -impl Debug for RespError { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.err) - } -} - -impl Display for RespError { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.err) - } -} - -impl From for RespError { - fn from(err: cozo::Error) -> RespError { - RespError { err } - } -} - -impl ResponseError for RespError { - fn error_response(&self) -> HttpResponse { - let formatted = format!("{:?}", self.err); - HttpResponse::BadRequest().body(formatted) - } -} - #[derive(Parser, Debug)] #[clap(version, about, long_about = None)] struct Args { @@ -69,180 +25,7 @@ struct Args { port: u16, } -struct AppStateWithDb { - db: Db, - pass_cache: Arc>>>, - seed: Box<[u8]>, -} - -const PASSWORD_KEY: &str = "WEB_USER_PASSWORD"; - -impl AppStateWithDb { - async fn verify_password(&self, req: &HttpRequest) -> miette::Result<()> { - let username = req - .headers() - .get(&HeaderName::from_static("x-cozo-username")) - .ok_or_else(|| miette!("not authenticated"))? - .to_str() - .into_diagnostic()?; - let password = req - .headers() - .get(&HeaderName::from_static("x-cozo-password")) - .ok_or_else(|| miette!("not authenticated"))? - .to_str() - .into_diagnostic()?; - let existing = self.pass_cache.try_read().map_err(|e| miette!(e.to_string()))?.get(username).cloned(); - if let Some(stored) = existing { - let mut seed = self.seed.to_vec(); - seed.extend_from_slice(password.as_bytes()); - let digest: &[u8] = &sha3::Sha3_256::digest(&seed); - if *stored == *digest { - return Ok(()); - } else { - self.pass_cache.try_write().map_err(|e| miette!(e.to_string()))?.remove(username); - bail!("invalid password") - } - } - let pass_cache = self.pass_cache.clone(); - let mut seed = self.seed.to_vec(); - let db = self.db.new_session()?; - let password = password.to_string(); - let username = username.to_string(); - spawn_blocking(move || -> miette::Result<()> { - if let Some(hashed) = db.get_meta_kv(&[PASSWORD_KEY, &username])? { - let hashed = from_utf8(&hashed).into_diagnostic()?; - if argon2::verify_encoded(&hashed, password.as_bytes()).into_diagnostic()? { - seed.extend_from_slice(password.as_bytes()); - let easy_digest: &[u8] = &sha3::Sha3_256::digest(&seed); - pass_cache - .try_write().map_err(|e| miette!(e.to_string()))? - .insert(username, easy_digest.into()); - return Ok(()); - } - } - bail!("invalid password") - }) - .await - .into_diagnostic()? - } - - async fn reset_password(&self, user: &str, new_pass: &str) -> miette::Result<()> { - let pass_cache = self.pass_cache.clone(); - let db = self.db.new_session()?; - let username = user.to_string(); - let new_pass = new_pass.to_string(); - spawn_blocking(move || -> miette::Result<()> { - pass_cache.try_write().map_err(|e| miette!(e.to_string()))?.remove(&username); - let salt = rand::thread_rng().gen::<[u8; 32]>(); - let config = argon2config(); - let hash = - argon2::hash_encoded(new_pass.as_bytes(), &salt, &config).into_diagnostic()?; - db.put_meta_kv(&[PASSWORD_KEY, &username], hash.as_bytes())?; - Ok(()) - }) - .await - .into_diagnostic()? - } - - async fn remove_user(&self, user: &str) -> miette::Result<()> { - self.pass_cache.try_write().map_err(|e| miette!(e.to_string()))?.remove(user); - self.db.remove_meta_kv(&[PASSWORD_KEY, &user])?; - Ok(()) - } -} - -fn argon2config() -> argon2::Config<'static> { - argon2::Config { - variant: argon2::Variant::Argon2id, - mem_cost: 65536, - time_cost: 10, - ..argon2::Config::default() - } -} - -#[derive(serde_derive::Serialize, serde_derive::Deserialize)] -struct QueryPayload { - script: String, - params: BTreeMap, -} - -#[post("/text-query")] -async fn query( - body: web::Json, - data: web::Data, - req: HttpRequest, -) -> Result { - data.verify_password(&req).await?; - let db = data.db.new_session()?; - let start = Instant::now(); - let task = spawn_blocking(move || db.run_script(&body.script, &body.params)); - let mut result = task.await.map_err(|e| miette!(e))??; - if let Some(obj) = result.as_object_mut() { - obj.insert( - "time_taken".to_string(), - json!(start.elapsed().as_millis() as u64), - ); - } - Ok(HttpResponse::Ok().json(result)) -} - -#[derive(serde_derive::Serialize, serde_derive::Deserialize)] -struct ChangePassPayload { - new_pass: String, -} - -#[post("/change-password")] -async fn change_password( - body: web::Json, - data: web::Data, - req: HttpRequest, -) -> Result { - data.verify_password(&req).await?; - let username = req - .headers() - .get(&HeaderName::from_static("x-cozo-username")) - .ok_or_else(|| miette!("not authenticated"))? - .to_str() - .map_err(|e| miette!(e))?; - data.reset_password(username, &body.new_pass).await?; - Ok(HttpResponse::Ok().json(json!({"status": "OK"}))) -} - -#[derive(serde_derive::Serialize, serde_derive::Deserialize)] -struct AssertUserPayload { - username: String, - new_pass: String, -} - -#[post("/assert-user")] -async fn assert_user( - body: web::Json, - data: web::Data, - req: HttpRequest, -) -> Result { - data.verify_password(&req).await?; - data.reset_password(&body.username, &body.new_pass).await?; - Ok(HttpResponse::Ok().json(json!({"status": "OK"}))) -} - -#[derive(serde_derive::Serialize, serde_derive::Deserialize)] -struct RemoveUserPayload { - username: String, -} - -#[post("/remove-user")] -async fn remove_user( - body: web::Json, - data: web::Data, - req: HttpRequest, -) -> Result { - data.verify_password(&req).await?; - data.remove_user(&body.username).await?; - Ok(HttpResponse::Ok().json(json!({"status": "OK"}))) -} - -#[actix_web::main] -async fn main() -> std::io::Result<()> { +fn main() { env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); let args = Args::parse(); @@ -251,78 +34,34 @@ async fn main() -> std::io::Result<()> { .create_if_missing(true); let db = Db::build(builder).unwrap(); + let addr = format!("{}:{}", args.bind, args.port); + println!("Service running at http://{}", addr); + rouille::start_server(addr, move |request| { + router!(request, + (POST) (/text-query) => { + #[derive(serde_derive::Serialize, serde_derive::Deserialize)] + struct QueryPayload { + script: String, + params: BTreeMap, + } - match db.meta_range_scan(&[PASSWORD_KEY]).next() { - None => { - let (username, password) = match ( - env::var("COZO_INITIAL_WEB_USERNAME"), - env::var("COZO_INITIAL_WEB_PASSWORD"), - ) { - (Ok(username), Ok(password)) => (username, password), - _ => { - println!("Welcome to Cozo!"); - println!(); - println!( - "This is the first time you are running this database at {},", - args.path - ); - println!("so let's create a username and password."); - - loop { - println!(); - print!("Enter a username: "); - - let _ = stdout().flush(); - let mut username = String::new(); - stdin().read_line(&mut username).unwrap(); - let username = username.trim().to_string(); - if username.is_empty() { - continue; - } - let password = rpassword::prompt_password("Enter your password: ").unwrap(); - let confpass = rpassword::prompt_password("Again to confirm it: ").unwrap(); + let payload: QueryPayload = try_or_400!(rouille::input::json_input(request)); + let start = Instant::now(); - if password.trim() != confpass.trim() { - println!("Password mismatch. Try again."); - continue; + match db.run_script(&payload.script, &payload.params) { + Ok(mut result) => { + if let Some(obj) = result.as_object_mut() { + obj.insert( + "time_taken".to_string(), + json!(start.elapsed().as_millis() as u64), + ); } - break (username, password.trim().to_string()); + Response::json(&result) } + Err(e) => Response::text(format!("{:?}", e)).with_status_code(400), } - }; - - let salt = rand::thread_rng().gen::<[u8; 32]>(); - let config = argon2config(); - let hash = argon2::hash_encoded(password.trim().as_bytes(), &salt, &config).unwrap(); - db.put_meta_kv(&[PASSWORD_KEY, &username], hash.as_bytes()) - .unwrap(); - } - Some(Err(err)) => panic!("{}", err), - Some(Ok((user, _))) => { - debug!("User {:?}", user[1]); - } - } - - let app_state = web::Data::new(AppStateWithDb { - db, - pass_cache: Arc::new(Default::default()), - seed: Box::new(rand::thread_rng().gen::<[u8; 32]>()), + }, + _ => Response::empty_404() + ) }); - - let addr = (&args.bind as &str, args.port); - println!("Service running at http://{}:{}", addr.0, addr.1); - - HttpServer::new(move || { - App::new() - .app_data(app_state.clone()) - .wrap(Cors::permissive()) - .wrap(Logger::default()) - .service(query) - .service(change_password) - .service(assert_user) - .service(remove_user) - }) - .bind(addr)? - .run() - .await -} \ No newline at end of file +} diff --git a/src/algo/csv.rs b/src/algo/csv.rs index 10282e0b..c89d8a3e 100644 --- a/src/algo/csv.rs +++ b/src/algo/csv.rs @@ -118,16 +118,16 @@ impl AlgoImpl for CsvReader { } }), ColType::Int => { - let f = op_to_float(&[dv]).unwrap_or(DataValue::Null); + let f = op_to_float(&[dv]).unwrap_or(DataValue::Null); match f.get_int() { - None => {if typ.nullable { - out_tuple.0.push(DataValue::Null) - } else { - bail!("cannot convert {} to type {}", s, typ) - }} - Some(i) => { - out_tuple.0.push(DataValue::from(i)) + None => { + if typ.nullable { + out_tuple.0.push(DataValue::Null) + } else { + bail!("cannot convert {} to type {}", s, typ) + } } + Some(i) => out_tuple.0.push(DataValue::from(i)), }; } _ => bail!("cannot convert {} to type {}", s, typ), @@ -149,9 +149,8 @@ impl AlgoImpl for CsvReader { } } None => { - let content = reqwest::blocking::get(&url as &str) - .into_diagnostic()? - .text() + let content = minreq::get(&url as &str) + .send() .into_diagnostic()?; let mut rdr = rdr_builder.from_reader(content.as_bytes()); for record in rdr.records() { diff --git a/src/algo/jlines.rs b/src/algo/jlines.rs index 00b1d301..0cda66e2 100644 --- a/src/algo/jlines.rs +++ b/src/algo/jlines.rs @@ -98,10 +98,8 @@ impl AlgoImpl for JsonReader { } } None => { - let content = reqwest::blocking::get(&url as &str) - .into_diagnostic()? - .text() - .into_diagnostic()?; + let content = minreq::get(&url as &str).send().into_diagnostic()?; + let content = content.as_str().into_diagnostic()?; if json_lines { for line in content.lines() { let line = line.trim(); diff --git a/src/runtime/db.rs b/src/runtime/db.rs index 03a97f53..9df8b038 100644 --- a/src/runtime/db.rs +++ b/src/runtime/db.rs @@ -14,13 +14,13 @@ use serde_json::json; use smartstring::SmartString; use thiserror::Error; -use cozorocks::{DbBuilder, DbIter, RocksDb}; +use cozorocks::{DbBuilder, RocksDb}; use crate::data::json::JsonValue; use crate::data::program::{InputProgram, QueryAssertion, RelationOp}; use crate::data::symb::Symbol; use crate::data::tuple::{ - compare_tuple_keys, rusty_scratch_cmp, EncodedTuple, Tuple, SCRATCH_DB_KEY_PREFIX_LEN, + compare_tuple_keys, rusty_scratch_cmp, Tuple, SCRATCH_DB_KEY_PREFIX_LEN, }; use crate::data::value::{DataValue, LARGEST_UTF_CHAR}; use crate::parse::sys::SysOp; @@ -32,7 +32,6 @@ use crate::query::relation::{ }; use crate::runtime::relation::{RelationHandle, RelationId}; use crate::runtime::transact::SessionTx; -use crate::utils::swap_option_result; struct RunningQueryHandle { started_at: f64, @@ -668,113 +667,6 @@ impl Db { .collect_vec(); Ok(json!({"rows": res, "headers": ["id", "started_at"]})) } - pub fn put_meta_kv(&self, k: &[&str], v: &[u8]) -> Result<()> { - let mut ks = vec![DataValue::Guard]; - for el in k { - ks.push(DataValue::Str(SmartString::from(*el))); - } - let key = Tuple(ks).encode_as_key(RelationId::SYSTEM); - let mut vtx = self.db.transact().start(); - vtx.put(&key, v)?; - vtx.commit()?; - Ok(()) - } - pub fn remove_meta_kv(&self, k: &[&str]) -> Result<()> { - let mut ks = vec![DataValue::Guard]; - for el in k { - ks.push(DataValue::Str(SmartString::from(*el))); - } - let key = Tuple(ks).encode_as_key(RelationId::SYSTEM); - let mut vtx = self.db.transact().start(); - vtx.del(&key)?; - vtx.commit()?; - Ok(()) - } - pub fn get_meta_kv(&self, k: &[&str]) -> Result>> { - let mut ks = vec![DataValue::Guard]; - for el in k { - ks.push(DataValue::Str(SmartString::from(*el))); - } - let key = Tuple(ks).encode_as_key(RelationId::SYSTEM); - let vtx = self.db.transact().start(); - Ok(vtx.get(&key, false)?.map(|slice| slice.to_vec())) - } - pub fn meta_range_scan( - &self, - prefix: &[&str], - ) -> impl Iterator, Vec)>> { - let mut lower_bound = Tuple(vec![DataValue::Guard]); - for p in prefix { - lower_bound.0.push(DataValue::Str(SmartString::from(*p))); - } - let upper_data_bound = Tuple(vec![DataValue::Bot]); - let upper_bound = upper_data_bound.encode_as_key(RelationId::SYSTEM); - let mut it = self - .db - .transact() - .start() - .iterator() - .upper_bound(&upper_bound) - .start(); - it.seek(&lower_bound.encode_as_key(RelationId::SYSTEM)); - - struct CustomIter { - it: DbIter, - started: bool, - upper_bound: Vec, - } - - impl CustomIter { - fn next_inner(&mut self) -> Result, Vec)>> { - if self.started { - self.it.next() - } else { - self.started = true; - } - match self.it.pair()? { - None => Ok(None), - Some((k_slice, v_slice)) => { - if compare_tuple_keys(&self.upper_bound, k_slice) != Greater { - return Ok(None); - } - - #[derive(Debug, Error, Diagnostic)] - #[error("Encountered corrupt key in meta store")] - #[diagnostic(code(db::corrupt_meta_key))] - #[diagnostic(help("This is an internal error. Please file a bug."))] - struct CorruptKeyInMetaStoreError; - - let encoded = EncodedTuple(k_slice).decode(); - let ks: Vec<_> = encoded - .0 - .into_iter() - .skip(1) - .map(|v| { - v.get_string() - .map(|s| s.to_string()) - .ok_or(CorruptKeyInMetaStoreError) - }) - .try_collect()?; - Ok(Some((ks, v_slice.to_vec()))) - } - } - } - } - - impl Iterator for CustomIter { - type Item = Result<(Vec, Vec)>; - - fn next(&mut self) -> Option { - swap_option_result(self.next_inner()) - } - } - - CustomIter { - it, - started: false, - upper_bound, - } - } pub fn list_relation(&self, name: &str) -> Result { let tx = self.transact()?; let handle = tx.get_relation(name, false)?; diff --git a/tutorial/0-getting-started.ipynb b/tutorial/0-getting-started.ipynb index 759c13a2..d7f19b63 100644 --- a/tutorial/0-getting-started.ipynb +++ b/tutorial/0-getting-started.ipynb @@ -106,8 +106,7 @@ "id": "81436147-dd67-4f0e-a9c0-d6c18c37495c", "metadata": {}, "source": [ - "%reload_ext pycozo.ipyext_direct\n", - "%cozo_auth YOUR_USERNAME" + "%reload_ext pycozo.ipyext_direct" ] }, { diff --git a/tutorial/1-acrobatics.ipynb b/tutorial/1-acrobatics.ipynb index 63561ed1..af5b3459 100644 --- a/tutorial/1-acrobatics.ipynb +++ b/tutorial/1-acrobatics.ipynb @@ -9,12 +9,11 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ - "%reload_ext pycozo.ipyext_direct\n", - "%cozo_auth tutorial *******" + "%reload_ext pycozo.ipyext_direct" ] }, { @@ -35,13 +34,13 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 0ms

" + "

Completed in 1 ms

" ], "text/plain": [ "" @@ -54,34 +53,34 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 abcabc
0helloworldCozo!0helloworldCozo!
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 2, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -105,13 +104,13 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -124,40 +123,40 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 abcabc
0helloworldCozo!0helloworldCozo!
1helloworlddatabase!1helloworlddatabase!
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 3, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -176,13 +175,13 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 0ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -195,38 +194,38 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 aa
0Cozo!0Cozo!
1hello1hello
2world2world
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 4, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -246,13 +245,13 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 0ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -265,42 +264,42 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 aa
0Cozo!0Cozo!
1Cozo.1Cozo.
2hello2hello
3world3world
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 5, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -334,13 +333,13 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 2ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -353,76 +352,76 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 aa
0None0None
1False1False
2True2True
3-0.0000003-0.000000
41.00000041.000000
53.14159053.141590
6123456761234567
7A7A
8Apple juice8Apple juice
9apple9apple
10['apple', 1, [2, 3]]10['apple', 1, [2, 3]]
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 6, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -452,13 +451,13 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 0ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -471,60 +470,60 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 iaia
013013
12121212
230.833333230.833333
341096.633158341096.633158
45NUMBER 1045NUMBER 10
563.141593563.141593
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 7, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -556,7 +555,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -572,7 +571,7 @@ "\u001b[36m help: \u001b[0m'negate' requires booleans\n" ] }, - "execution_count": 8, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -590,13 +589,13 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 0ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -609,30 +608,30 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 aa
0False0False
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 9, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -664,13 +663,13 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -683,67 +682,67 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 lovinglovedlovingloved
0aliceeve0aliceeve
1bobalice1bobalice
2charlieeve2charlieeve
3davidgeorge3davidgeorge
4evealice4evealice
5evebob5evebob
6evecharlie6evecharlie
7georgegeorge7georgegeorge
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 10, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -775,13 +774,13 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -794,38 +793,38 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 loved_by_eveloved_by_eve
0alice0alice
1bob1bob
2charlie2charlie
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 11, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -852,13 +851,13 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -871,34 +870,34 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 loves_eveloves_eve
0alice0alice
1charlie1charlie
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 12, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -926,13 +925,13 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -945,30 +944,30 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 loved_by_b_eloved_by_b_e
0alice0alice
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 13, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -1002,13 +1001,13 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1021,34 +1020,34 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 loved_by_b_eloved_by_b_e
0alice0alice
1charlie1charlie
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 14, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -1084,13 +1083,13 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1103,34 +1102,34 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 loved_by_b_eloved_by_b_e
0alice0alice
1charlie1charlie
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 15, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -1165,13 +1164,13 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1184,37 +1183,37 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 personlovedpersonloved
0bobalice0bobalice
1davidgeorge1davidgeorge
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 16, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -1243,13 +1242,13 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1262,34 +1261,34 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 lovedloved
0alice0alice
1george1george
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 17, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -1316,7 +1315,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -1333,7 +1332,7 @@ "\u001b[36m help: \u001b[0mNote that symbols occurring only in negated positions are not considered bound\n" ] }, - "execution_count": 18, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -1367,13 +1366,13 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1386,34 +1385,34 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 loved_by_e_not_bloved_by_e_not_b
0bob0bob
1charlie1charlie
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 19, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -1452,7 +1451,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -1469,7 +1468,7 @@ "\u001b[36m help: \u001b[0mNote that symbols occurring only in negated positions are not considered bound\n" ] }, - "execution_count": 20, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -1507,13 +1506,13 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1526,46 +1525,46 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 not_loved_by_bnot_loved_by_b
0bob0bob
1charlie1charlie
2david2david
3eve3eve
4george4george
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 21, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -1615,13 +1614,13 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1634,34 +1633,34 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 loves_eveloves_eve
0alice0alice
1charlie1charlie
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 22, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -1688,13 +1687,13 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1707,34 +1706,34 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 loves_eveloves_eve
0alice0alice
1charlie1charlie
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 23, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -1768,13 +1767,13 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 0ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1787,38 +1786,38 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 uu
0a0a
1b1b
2c2c
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 24, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -1836,13 +1835,13 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 0ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1855,57 +1854,57 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 uvuv
0ax0ax
1ay1ay
2bx2bx
3by3by
4cx4cx
5cy5cy
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 25, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -1937,13 +1936,13 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -1956,42 +1955,42 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
 chainedchained
0alice0alice
1bob1bob
2charlie2charlie
3eve3eve
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 26, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -2032,13 +2031,13 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 33, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "

Completed in 1ms

" + "

Completed in 0 ms

" ], "text/plain": [ "" @@ -2052,11 +2051,11 @@ "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -2064,10 +2063,10 @@ "
 chainedchained
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 27, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -2105,7 +2104,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -2119,7 +2118,7 @@ " (negation, non-meet aggregation, or algorithm-application).\n" ] }, - "execution_count": 28, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" }