Cleanup a few things in the code (#3793)
Co-authored-by: Rushmore Mushambi <rushmore@surrealdb.com>
This commit is contained in:
parent
53b2878a93
commit
b03aeca08c
36 changed files with 215 additions and 488 deletions
103
Cargo.lock
generated
103
Cargo.lock
generated
|
@ -5809,8 +5809,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"serial_test",
|
||||
"surrealdb-core 1.3.0",
|
||||
"surrealdb-core 2.0.0-1.5.0",
|
||||
"surrealdb-core",
|
||||
"temp-dir",
|
||||
"test-log",
|
||||
"thiserror",
|
||||
|
@ -5830,89 +5829,6 @@ dependencies = [
|
|||
"ws_stream_wasm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "surrealdb-core"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24b66c830b767da9b8a289877b2ea3c290b6a56482ae604848b977446cdcdda6"
|
||||
dependencies = [
|
||||
"addr",
|
||||
"any_ascii",
|
||||
"arbitrary",
|
||||
"argon2",
|
||||
"async-channel 1.9.0",
|
||||
"async-executor",
|
||||
"async-recursion 1.0.5",
|
||||
"base64 0.21.7",
|
||||
"bcrypt",
|
||||
"bincode",
|
||||
"bytes",
|
||||
"cedar-policy",
|
||||
"chrono",
|
||||
"deunicode",
|
||||
"dmp",
|
||||
"echodb",
|
||||
"foundationdb",
|
||||
"fst",
|
||||
"futures",
|
||||
"fuzzy-matcher",
|
||||
"geo 0.27.0",
|
||||
"geo-types",
|
||||
"hex",
|
||||
"indxdb",
|
||||
"ipnet",
|
||||
"lexicmp",
|
||||
"md-5",
|
||||
"nanoid",
|
||||
"ndarray",
|
||||
"nom",
|
||||
"num_cpus",
|
||||
"object_store",
|
||||
"once_cell",
|
||||
"pbkdf2",
|
||||
"pharos",
|
||||
"phf",
|
||||
"pin-project-lite",
|
||||
"quick_cache",
|
||||
"radix_trie",
|
||||
"rand 0.8.5",
|
||||
"regex",
|
||||
"regex-syntax 0.8.2",
|
||||
"reqwest",
|
||||
"revision",
|
||||
"ring 0.17.7",
|
||||
"roaring",
|
||||
"rocksdb",
|
||||
"rquickjs",
|
||||
"rust-stemmers",
|
||||
"rust_decimal",
|
||||
"scrypt",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha1",
|
||||
"sha2",
|
||||
"snap",
|
||||
"speedb",
|
||||
"storekey",
|
||||
"surrealdb-derive",
|
||||
"surrealdb-jsonwebtoken",
|
||||
"surrealdb-tikv-client",
|
||||
"surrealkv",
|
||||
"surrealml-core 0.0.8",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"trice",
|
||||
"ulid",
|
||||
"unicase",
|
||||
"url",
|
||||
"uuid",
|
||||
"wasm-bindgen-futures",
|
||||
"wasmtimer",
|
||||
"ws_stream_wasm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "surrealdb-core"
|
||||
version = "2.0.0-1.5.0"
|
||||
|
@ -5986,7 +5902,7 @@ dependencies = [
|
|||
"surrealdb-jsonwebtoken",
|
||||
"surrealdb-tikv-client",
|
||||
"surrealkv",
|
||||
"surrealml-core 0.1.1",
|
||||
"surrealml-core",
|
||||
"temp-dir",
|
||||
"tempfile",
|
||||
"test-log",
|
||||
|
@ -6085,21 +6001,6 @@ dependencies = [
|
|||
"vart",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "surrealml-core"
|
||||
version = "0.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12c54e2e688e15c48e3bd26824311c5143b17028391733f88862f162f70dd4ca"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"ndarray",
|
||||
"once_cell",
|
||||
"ort",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "surrealml-core"
|
||||
version = "0.1.1"
|
||||
|
|
|
@ -20,7 +20,6 @@ http = ["surrealdb/http"]
|
|||
http-compression = []
|
||||
ml = ["surrealdb/ml"]
|
||||
jwks = ["surrealdb/jwks"]
|
||||
sql2 = [] # Deprecated since v1.4
|
||||
parser2 = ["surrealdb/parser2"]
|
||||
performance-profiler = ["dep:pprof"]
|
||||
|
||||
|
@ -83,7 +82,6 @@ surrealdb = { version = "1", path = "lib", features = [
|
|||
"protocol-http",
|
||||
"protocol-ws",
|
||||
"rustls",
|
||||
"sql2",
|
||||
] }
|
||||
tempfile = "3.8.1"
|
||||
thiserror = "1.0.50"
|
||||
|
|
|
@ -11,13 +11,13 @@ args = ["check", "--locked", "--workspace"]
|
|||
category = "CI - CHECK"
|
||||
command = "cargo"
|
||||
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
args = ["check", "--locked", "--package", "surrealdb", "--features", "protocol-ws,protocol-http,kv-mem,kv-indxdb,http,jwks,sql2", "--target", "wasm32-unknown-unknown"]
|
||||
args = ["check", "--locked", "--package", "surrealdb", "--features", "protocol-ws,protocol-http,kv-mem,kv-indxdb,http,jwks", "--target", "wasm32-unknown-unknown"]
|
||||
|
||||
[tasks.ci-clippy]
|
||||
category = "CI - CHECK"
|
||||
command = "cargo"
|
||||
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
args = ["clippy", "--all-targets", "--features", "storage-mem,storage-rocksdb,storage-speedb,storage-tikv,storage-fdb,scripting,http,jwks,sql2", "--tests", "--benches", "--examples", "--bins", "--", "-D", "warnings"]
|
||||
args = ["clippy", "--all-targets", "--features", "storage-mem,storage-rocksdb,storage-speedb,storage-tikv,storage-fdb,scripting,http,jwks", "--tests", "--benches", "--examples", "--bins", "--", "-D", "warnings"]
|
||||
|
||||
#
|
||||
# Integration Tests
|
||||
|
@ -27,32 +27,32 @@ args = ["clippy", "--all-targets", "--features", "storage-mem,storage-rocksdb,st
|
|||
category = "CI - INTEGRATION TESTS"
|
||||
command = "cargo"
|
||||
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable", RUST_LOG = { value = "cli_integration=debug", condition = { env_not_set = ["RUST_LOG"] } } }
|
||||
args = ["test", "--locked", "--no-default-features", "--features", "storage-mem,storage-surrealkv,http,scripting,jwks,sql2", "--workspace", "--test", "cli_integration", "--", "cli_integration"]
|
||||
args = ["test", "--locked", "--no-default-features", "--features", "storage-mem,storage-surrealkv,http,scripting,jwks", "--workspace", "--test", "cli_integration", "--", "cli_integration"]
|
||||
|
||||
[tasks.ci-http-integration]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
command = "cargo"
|
||||
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable", RUST_LOG = { value = "http_integration=debug", condition = { env_not_set = ["RUST_LOG"] } } }
|
||||
args = ["test", "--locked", "--no-default-features", "--features", "storage-mem,http-compression,jwks,sql2", "--workspace", "--test", "http_integration", "--", "http_integration"]
|
||||
args = ["test", "--locked", "--no-default-features", "--features", "storage-mem,http-compression,jwks", "--workspace", "--test", "http_integration", "--", "http_integration"]
|
||||
|
||||
[tasks.ci-ws-integration]
|
||||
category = "WS - INTEGRATION TESTS"
|
||||
command = "cargo"
|
||||
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable", RUST_LOG = { value = "ws_integration=debug", condition = { env_not_set = ["RUST_LOG"] } } }
|
||||
args = ["test", "--locked", "--no-default-features", "--features", "storage-mem,sql2", "--workspace", "--test", "ws_integration", "--", "ws_integration"]
|
||||
args = ["test", "--locked", "--no-default-features", "--features", "storage-mem", "--workspace", "--test", "ws_integration", "--", "ws_integration"]
|
||||
|
||||
[tasks.ci-ml-integration]
|
||||
category = "ML - INTEGRATION TESTS"
|
||||
command = "cargo"
|
||||
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable", RUST_LOG = { value = "cli_integration::common=debug", condition = { env_not_set = ["RUST_LOG"] } } }
|
||||
args = ["test", "--locked", "--features", "storage-mem,ml,sql2", "--workspace", "--test", "ml_integration", "--", "ml_integration", "--nocapture"]
|
||||
args = ["test", "--locked", "--features", "storage-mem,ml", "--workspace", "--test", "ml_integration", "--", "ml_integration", "--nocapture"]
|
||||
|
||||
[tasks.ci-workspace-coverage]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
command = "cargo"
|
||||
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
args = [
|
||||
"llvm-cov", "--html", "--locked", "--no-default-features", "--features", "storage-mem,scripting,http,jwks,sql2", "--workspace", "--",
|
||||
"llvm-cov", "--html", "--locked", "--no-default-features", "--features", "storage-mem,scripting,http,jwks", "--workspace", "--",
|
||||
"--skip", "api_integration",
|
||||
"--skip", "cli_integration",
|
||||
"--skip", "http_integration",
|
||||
|
@ -66,7 +66,7 @@ category = "CI - INTEGRATION TESTS"
|
|||
command = "cargo"
|
||||
env = { RUST_BACKTRACE = 1, RUSTFLAGS = "--cfg surrealdb_unstable", RUSTDOCFLAGS = "--cfg surrealdb_unstable" }
|
||||
args = [
|
||||
"test", "--locked", "--no-default-features", "--features", "storage-mem,scripting,http,parser2,sql2", "--workspace", "--",
|
||||
"test", "--locked", "--no-default-features", "--features", "storage-mem,scripting,http,parser2", "--workspace", "--",
|
||||
"--skip", "api_integration",
|
||||
"--skip", "cli_integration",
|
||||
"--skip", "http_integration",
|
||||
|
@ -78,7 +78,7 @@ args = [
|
|||
category = "CI - INTEGRATION TESTS"
|
||||
command = "cargo"
|
||||
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
args = ["llvm-cov", "--html", "--locked", "--no-default-features", "--features", "sql2,protocol-ws,protocol-http,kv-mem,kv-rocksdb", "--workspace"]
|
||||
args = ["llvm-cov", "--html", "--locked", "--no-default-features", "--features", "protocol-ws,protocol-http,kv-mem,kv-rocksdb", "--workspace"]
|
||||
|
||||
[tasks.ci-workspace-coverage-complete]
|
||||
env = { _START_SURREALDB_PATH = "memory" }
|
||||
|
@ -86,7 +86,7 @@ category = "CI - INTEGRATION TESTS"
|
|||
run_task = { name = ["start-surrealdb", "test-workspace-coverage-complete", "stop-surrealdb"], fork = true }
|
||||
|
||||
[tasks.ci-database-upgrade]
|
||||
env = { _TEST_FEATURES = "storage-rocksdb,sql2" }
|
||||
env = { _TEST_FEATURES = "storage-rocksdb" }
|
||||
category = "CI - DATABASE UPGRADE TESTS"
|
||||
run_task = { name = ["test-database-upgrade"], fork = true }
|
||||
|
||||
|
@ -125,17 +125,17 @@ args = ["test", "--locked", "--no-default-features", "--features", "${_TEST_FEAT
|
|||
|
||||
[tasks.ci-api-integration-http]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
env = { _TEST_API_ENGINE = "http", _TEST_FEATURES = "protocol-http,sql2", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
env = { _TEST_API_ENGINE = "http", _TEST_FEATURES = "protocol-http", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
run_task = "ci-api-integration"
|
||||
|
||||
[tasks.ci-api-integration-ws]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
env = { _TEST_API_ENGINE = "ws", _TEST_FEATURES = "protocol-ws,sql2", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
env = { _TEST_API_ENGINE = "ws", _TEST_FEATURES = "protocol-ws", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
run_task = "ci-api-integration"
|
||||
|
||||
[tasks.ci-api-integration-any]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
env = { _TEST_API_ENGINE = "any", _TEST_FEATURES = "protocol-http,sql2", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
env = { _TEST_API_ENGINE = "any", _TEST_FEATURES = "protocol-http", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
run_task = "ci-api-integration"
|
||||
|
||||
#
|
||||
|
@ -143,42 +143,38 @@ run_task = "ci-api-integration"
|
|||
#
|
||||
[tasks.ci-api-integration-mem]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
env = { _TEST_API_ENGINE = "mem", _TEST_FEATURES = "kv-mem,sql2" }
|
||||
env = { _TEST_API_ENGINE = "mem", _TEST_FEATURES = "kv-mem" }
|
||||
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = true }
|
||||
|
||||
[tasks.ci-api-integration-file]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
env = { _TEST_API_ENGINE = "file", _TEST_FEATURES = "kv-rocksdb,sql2" }
|
||||
env = { _TEST_API_ENGINE = "file", _TEST_FEATURES = "kv-rocksdb" }
|
||||
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = true }
|
||||
|
||||
[tasks.ci-api-integration-rocksdb]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
env = { _TEST_API_ENGINE = "rocksdb", _TEST_FEATURES = "kv-rocksdb,sql2" }
|
||||
env = { _TEST_API_ENGINE = "rocksdb", _TEST_FEATURES = "kv-rocksdb" }
|
||||
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = true }
|
||||
|
||||
[tasks.ci-api-integration-speedb]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
env = { _TEST_API_ENGINE = "speedb", _TEST_FEATURES = "kv-speedb,sql2" }
|
||||
env = { _TEST_API_ENGINE = "speedb", _TEST_FEATURES = "kv-speedb" }
|
||||
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = true }
|
||||
|
||||
[tasks.ci-api-integration-fdb]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
env = { _TEST_API_ENGINE = "fdb", _TEST_FEATURES = "kv-fdb-7_1,sql2" }
|
||||
env = { _TEST_API_ENGINE = "fdb", _TEST_FEATURES = "kv-fdb-7_1" }
|
||||
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = false }
|
||||
|
||||
[tasks.ci-api-integration-tikv-tests]
|
||||
[tasks.ci-api-integration-surrealkv]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
env = { _TEST_API_ENGINE = "tikv", _TEST_FEATURES = "kv-tikv,sql2" }
|
||||
env = { _TEST_API_ENGINE = "surrealkv", _TEST_FEATURES = "kv-surrealkv" }
|
||||
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = false }
|
||||
|
||||
[tasks.ci-api-integration-tikv]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
run_task = { name = ["start-tikv", "ci-api-integration-tikv-tests", "stop-tikv"], fork = true }
|
||||
|
||||
[tasks.ci-api-integration-surrealkv]
|
||||
category = "CI - INTEGRATION TESTS"
|
||||
env = { _TEST_API_ENGINE = "surrealkv", _TEST_FEATURES = "kv-surrealkv,sql2", RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
run_task = { name = ["test-kvs", "test-api-integration"], fork = true, parallel = false }
|
||||
env = { _TEST_API_ENGINE = "tikv", _TEST_FEATURES = "kv-tikv" }
|
||||
run_task = { name = ["start-tikv", "test-kvs", "test-api-integration", "stop-tikv"], fork = true, parallel = false }
|
||||
|
||||
|
||||
#
|
||||
|
@ -280,7 +276,7 @@ ${HOME}/.tiup/bin/tiup clean --all
|
|||
category = "CI - BUILD"
|
||||
command = "cargo"
|
||||
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
args = ["build", "--locked", "--no-default-features", "--features", "storage-mem,sql2"]
|
||||
args = ["build", "--locked", "--no-default-features", "--features", "storage-mem"]
|
||||
|
||||
#
|
||||
# Benchmarks - Common
|
||||
|
@ -289,7 +285,7 @@ args = ["build", "--locked", "--no-default-features", "--features", "storage-mem
|
|||
category = "CI - BENCHMARK"
|
||||
command = "cargo"
|
||||
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
args = ["bench", "--quiet", "--package", "surrealdb", "--no-default-features", "--features", "kv-mem,scripting,http,jwks,sql2", "${@}"]
|
||||
args = ["bench", "--quiet", "--package", "surrealdb", "--no-default-features", "--features", "kv-mem,scripting,http,jwks", "${@}"]
|
||||
|
||||
#
|
||||
# Benchmarks - SDB - Per Target
|
||||
|
@ -299,7 +295,7 @@ BENCH_WORKER_THREADS = { value = "1", condition = { env_not_set = ["BENCH_WORKER
|
|||
BENCH_NUM_OPS = { value = "1000", condition = { env_not_set = ["BENCH_NUM_OPS"] } }
|
||||
BENCH_DURATION = { value = "30", condition = { env_not_set = ["BENCH_DURATION"] } }
|
||||
BENCH_SAMPLE_SIZE = { value = "10", condition = { env_not_set = ["BENCH_SAMPLE_SIZE"] } }
|
||||
BENCH_FEATURES = { value = "protocol-ws,kv-mem,kv-rocksdb,kv-fdb-7_1,kv-surrealkv,sql2", condition = { env_not_set = ["BENCH_FEATURES"] } }
|
||||
BENCH_FEATURES = { value = "protocol-ws,kv-mem,kv-rocksdb,kv-fdb-7_1,kv-surrealkv", condition = { env_not_set = ["BENCH_FEATURES"] } }
|
||||
RUSTFLAGS = "--cfg surrealdb_unstable"
|
||||
|
||||
[tasks.bench-target]
|
||||
|
|
|
@ -18,14 +18,14 @@ dependencies = ["cargo-upgrade", "cargo-update"]
|
|||
category = "LOCAL USAGE"
|
||||
command = "cargo"
|
||||
env = { RUSTDOCFLAGS = "--cfg surrealdb_unstable" }
|
||||
args = ["doc", "--open", "--no-deps", "--package", "surrealdb", "--features", "rustls,native-tls,protocol-ws,protocol-http,kv-mem,kv-speedb,kv-rocksdb,kv-tikv,http,scripting,jwks,sql2"]
|
||||
args = ["doc", "--open", "--no-deps", "--package", "surrealdb", "--features", "rustls,native-tls,protocol-ws,protocol-http,kv-mem,kv-speedb,kv-rocksdb,kv-tikv,http,scripting,jwks"]
|
||||
|
||||
# Test
|
||||
[tasks.test]
|
||||
category = "LOCAL USAGE"
|
||||
command = "cargo"
|
||||
env = { RUSTFLAGS = "--cfg surrealdb_unstable", RUSTDOCFLAGS = "--cfg surrealdb_unstable", RUST_MIN_STACK={ value = "4194304", condition = { env_not_set = ["RUST_MIN_STACK"] } } }
|
||||
args = ["test", "--workspace", "--no-fail-fast", "--features", "sql2"]
|
||||
args = ["test", "--workspace", "--no-fail-fast"]
|
||||
|
||||
# Check
|
||||
[tasks.cargo-check]
|
||||
|
@ -72,7 +72,7 @@ args = ["clean"]
|
|||
category = "LOCAL USAGE"
|
||||
command = "cargo"
|
||||
env = { RUSTFLAGS = "--cfg surrealdb_unstable" }
|
||||
args = ["bench", "--package", "surrealdb", "--no-default-features", "--features", "kv-mem,http,scripting,jwks,sql2", "--", "${@}"]
|
||||
args = ["bench", "--package", "surrealdb", "--no-default-features", "--features", "kv-mem,http,scripting,jwks", "--", "${@}"]
|
||||
|
||||
# Run
|
||||
[tasks.run]
|
||||
|
|
|
@ -10,7 +10,7 @@ reduce_output = true
|
|||
default_to_workspace = false
|
||||
|
||||
[env]
|
||||
DEV_FEATURES={ value = "storage-mem,scripting,http,ml,jwks,sql2", condition = { env_not_set = ["DEV_FEATURES"] } }
|
||||
DEV_FEATURES={ value = "storage-mem,scripting,http,ml,jwks", condition = { env_not_set = ["DEV_FEATURES"] } }
|
||||
SURREAL_LOG={ value = "trace", condition = { env_not_set = ["SURREAL_LOG"] } }
|
||||
SURREAL_USER={ value = "root", condition = { env_not_set = ["SURREAL_USER"] } }
|
||||
SURREAL_PASS={ value = "root", condition = { env_not_set = ["SURREAL_PASS"] } }
|
||||
|
|
|
@ -11,11 +11,11 @@ repository = "https://github.com/surrealdb/surrealdb"
|
|||
homepage = "https://github.com/surrealdb/surrealdb"
|
||||
documentation = "https://docs.rs/surrealdb-core/"
|
||||
keywords = [
|
||||
"database",
|
||||
"embedded-database",
|
||||
"key-value",
|
||||
"key-value-store",
|
||||
"kv-store",
|
||||
"database",
|
||||
"embedded-database",
|
||||
"key-value",
|
||||
"key-value-store",
|
||||
"kv-store",
|
||||
]
|
||||
categories = ["database-implementations", "data-structures", "embedded"]
|
||||
license-file = "../LICENSE"
|
||||
|
@ -40,14 +40,14 @@ kv-fdb-7_1 = ["foundationdb/fdb-7_1", "kv-fdb", "dep:tempfile", "dep:ext-sort"]
|
|||
kv-surrealkv = ["dep:surrealkv", "tokio/time", "dep:tempfile", "dep:ext-sort"]
|
||||
scripting = ["dep:js"]
|
||||
http = ["dep:reqwest"]
|
||||
ml = ["dep:surrealml-core1", "dep:ndarray"]
|
||||
ml = ["dep:surrealml", "dep:ndarray"]
|
||||
jwks = ["dep:reqwest"]
|
||||
arbitrary = [
|
||||
"dep:arbitrary",
|
||||
"dep:regex-syntax",
|
||||
"rust_decimal/rust-fuzz",
|
||||
"geo-types/arbitrary",
|
||||
"uuid/arbitrary",
|
||||
"dep:arbitrary",
|
||||
"dep:regex-syntax",
|
||||
"rust_decimal/rust-fuzz",
|
||||
"geo-types/arbitrary",
|
||||
"uuid/arbitrary",
|
||||
]
|
||||
experimental-parser = ["dep:phf", "dep:unicase"]
|
||||
# Private features
|
||||
|
@ -55,20 +55,16 @@ kv-fdb = ["tokio/time"]
|
|||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
features = [
|
||||
"kv-mem",
|
||||
"kv-rocksdb",
|
||||
"http",
|
||||
"scripting",
|
||||
]
|
||||
features = ["kv-mem", "kv-rocksdb", "http", "scripting"]
|
||||
targets = []
|
||||
|
||||
[dependencies]
|
||||
addr = { version = "0.15.6", default-features = false, features = ["std"] }
|
||||
arbitrary = { version = "1.3.2", features = ["derive"], optional = true }
|
||||
argon2 = "0.5.2"
|
||||
ascii = { version = "0.3.2", package = "any_ascii" }
|
||||
async-recursion = "1.0.5"
|
||||
base64_lib = { version = "0.21.5", package = "base64" }
|
||||
base64 = "0.21.5"
|
||||
bcrypt = "0.15.0"
|
||||
bincode = "1.3.3"
|
||||
bytes = "1.5.0"
|
||||
|
@ -82,25 +78,26 @@ echodb = { version = "0.4.0", optional = true }
|
|||
executor = { version = "1.8.0", package = "async-executor" }
|
||||
ext-sort = { version = "^0.1.4", optional = true }
|
||||
foundationdb = { version = "0.8.0", default-features = false, features = [
|
||||
"embedded-fdb-include",
|
||||
"embedded-fdb-include",
|
||||
], optional = true }
|
||||
fst = "0.4.7"
|
||||
futures = "0.3.29"
|
||||
fuzzy-matcher = "0.3.7"
|
||||
geo = { version = "0.27.0", features = ["use-serde"] }
|
||||
geo-types = { version = "0.7.12", features = ["arbitrary"] }
|
||||
hex = { version = "0.4.3" }
|
||||
indxdb = { version = "0.4.0", optional = true }
|
||||
ipnet = "2.9.0"
|
||||
js = { version = "0.5.1", package = "rquickjs", features = [
|
||||
"array-buffer",
|
||||
"bindgen",
|
||||
"classes",
|
||||
"futures",
|
||||
"loader",
|
||||
"macro",
|
||||
"parallel",
|
||||
"properties",
|
||||
"rust-alloc",
|
||||
"array-buffer",
|
||||
"bindgen",
|
||||
"classes",
|
||||
"futures",
|
||||
"loader",
|
||||
"macro",
|
||||
"parallel",
|
||||
"properties",
|
||||
"rust-alloc",
|
||||
], optional = true }
|
||||
jsonwebtoken = { version = "8.3.0-surreal.1", package = "surrealdb-jsonwebtoken" }
|
||||
lexicmp = "0.1.0"
|
||||
|
@ -112,15 +109,18 @@ num_cpus = "1.16.0"
|
|||
object_store = { version = "0.8.0", optional = false }
|
||||
once_cell = "1.18.0"
|
||||
pbkdf2 = { version = "0.12.2", features = ["simple"] }
|
||||
phf = { version = "0.11.2", features = ["macros", "unicase"], optional = true }
|
||||
pin-project-lite = "0.2.13"
|
||||
quick_cache = "0.4.0"
|
||||
radix_trie = { version = "0.2.1", features = ["serde"] }
|
||||
rand = "0.8.5"
|
||||
reblessive = { version = "0.3.0" }
|
||||
regex = "1.10.2"
|
||||
regex-syntax = { version = "0.8.2", optional = true, features = ["arbitrary"] }
|
||||
reqwest = { version = "0.11.22", default-features = false, features = [
|
||||
"json",
|
||||
"stream",
|
||||
"multipart",
|
||||
"json",
|
||||
"stream",
|
||||
"multipart",
|
||||
], optional = true }
|
||||
revision = "0.5.0"
|
||||
roaring = { version = "0.10.2", features = ["serde"] }
|
||||
|
@ -136,21 +136,16 @@ sha2 = "0.10.8"
|
|||
snap = "1.1.0"
|
||||
speedb = { version = "0.0.4", features = ["lz4", "snappy"], optional = true }
|
||||
storekey = "0.5.0"
|
||||
surrealml-core1 = { version = "0.1.1", optional = true, package = "surrealml-core" }
|
||||
surrealkv = { version = "0.1.3", optional = true }
|
||||
surrealml = { version = "0.1.1", optional = true, package = "surrealml-core" }
|
||||
tempfile = { version = "3.10.1", optional = true }
|
||||
thiserror = "1.0.50"
|
||||
tikv = { version = "0.2.0-surreal.2", default-features = false, package = "surrealdb-tikv-client", optional = true }
|
||||
tracing = "0.1.40"
|
||||
trice = "0.4.0"
|
||||
ulid = { version = "1.1.0", features = ["serde"] }
|
||||
url = "2.5.0"
|
||||
phf = { version = "0.11.2", features = ["macros", "unicase"], optional = true }
|
||||
unicase = { version = "2.7.0", optional = true }
|
||||
arbitrary = { version = "1.3.2", features = ["derive"], optional = true }
|
||||
regex-syntax = { version = "0.8.2", optional = true, features = ["arbitrary"] }
|
||||
geo-types = { version = "0.7.12", features = ["arbitrary"] }
|
||||
reblessive = { version = "0.3.0" }
|
||||
url = "2.5.0"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = { version = "0.5.1", features = ["async_tokio"] }
|
||||
|
@ -166,24 +161,27 @@ wiremock = "0.5.22"
|
|||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
pharos = "0.5.3"
|
||||
ring = { version = "0.17.7", features = ["wasm32_unknown_unknown_js"] } # Make ring-based dependencies work on Wasm
|
||||
tokio = { version = "1.34.0", default-features = false, features = ["rt", "sync"] }
|
||||
ring = { version = "0.17.7", features = ["wasm32_unknown_unknown_js"] }
|
||||
tokio = { version = "1.34.0", default-features = false, features = [
|
||||
"rt",
|
||||
"sync",
|
||||
] }
|
||||
uuid = { version = "1.6.1", features = ["serde", "js", "v4", "v7"] }
|
||||
wasm-bindgen-futures = "0.4.39"
|
||||
wasmtimer = { version = "0.2.0", default-features = false, features = [
|
||||
"tokio",
|
||||
"tokio",
|
||||
] }
|
||||
ws_stream_wasm = "0.7.4"
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
tokio = { version = "1.34.0", default-features = false, features = [
|
||||
"macros",
|
||||
"io-util",
|
||||
"io-std",
|
||||
"fs",
|
||||
"rt-multi-thread",
|
||||
"time",
|
||||
"sync",
|
||||
"macros",
|
||||
"io-util",
|
||||
"io-std",
|
||||
"fs",
|
||||
"rt-multi-thread",
|
||||
"time",
|
||||
"sync",
|
||||
] }
|
||||
tokio-tungstenite = { version = "0.20.1", optional = true }
|
||||
uuid = { version = "1.6.1", features = ["serde", "v4", "v7"] }
|
||||
|
|
|
@ -7,7 +7,6 @@ use futures::StreamExt;
|
|||
use tokio::spawn;
|
||||
use tracing::instrument;
|
||||
use trice::Instant;
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use wasm_bindgen_futures::spawn_local as spawn;
|
||||
|
||||
|
|
|
@ -4,16 +4,25 @@
|
|||
//! and executors to process the operations. This module also gives a `context` to the transaction.
|
||||
mod distinct;
|
||||
mod executor;
|
||||
mod group;
|
||||
mod iterator;
|
||||
mod notification;
|
||||
mod options;
|
||||
mod plan;
|
||||
mod processor;
|
||||
mod response;
|
||||
mod result;
|
||||
mod session;
|
||||
mod statement;
|
||||
mod store;
|
||||
mod transaction;
|
||||
mod variables;
|
||||
|
||||
pub mod capabilities;
|
||||
pub mod lifecycle;
|
||||
pub mod node;
|
||||
|
||||
pub use self::capabilities::Capabilities;
|
||||
pub use self::lifecycle::*;
|
||||
pub use self::notification::*;
|
||||
pub use self::options::*;
|
||||
|
@ -26,15 +35,5 @@ pub(crate) use self::statement::*;
|
|||
pub(crate) use self::transaction::*;
|
||||
pub(crate) use self::variables::*;
|
||||
|
||||
pub mod capabilities;
|
||||
pub use self::capabilities::Capabilities;
|
||||
pub mod node;
|
||||
|
||||
mod group;
|
||||
#[doc(hidden)]
|
||||
pub mod lifecycle;
|
||||
mod processor;
|
||||
mod result;
|
||||
mod store;
|
||||
#[cfg(test)]
|
||||
pub(crate) mod test;
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::sql::value::Value;
|
|||
use crate::sql::TableType;
|
||||
use crate::syn::error::RenderedError as RenderedParserError;
|
||||
use crate::vs::Error as VersionstampError;
|
||||
use base64_lib::DecodeError as Base64Error;
|
||||
use base64::DecodeError as Base64Error;
|
||||
use bincode::Error as BincodeError;
|
||||
#[cfg(any(
|
||||
feature = "kv-surrealkv",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pub mod base64 {
|
||||
use crate::err::Error;
|
||||
use crate::sql::{Bytes, Value};
|
||||
use base64_lib::{engine::general_purpose::STANDARD_NO_PAD, Engine};
|
||||
use base64::{engine::general_purpose::STANDARD_NO_PAD, Engine};
|
||||
|
||||
pub fn encode((arg,): (Bytes,)) -> Result<Value, Error> {
|
||||
Ok(Value::from(STANDARD_NO_PAD.encode(&*arg)))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use base64_lib::alphabet::STANDARD;
|
||||
use base64_lib::engine::general_purpose::GeneralPurpose;
|
||||
use base64_lib::engine::general_purpose::GeneralPurposeConfig;
|
||||
use base64_lib::engine::DecodePaddingMode;
|
||||
use base64::alphabet::STANDARD;
|
||||
use base64::engine::general_purpose::GeneralPurpose;
|
||||
use base64::engine::general_purpose::GeneralPurposeConfig;
|
||||
use base64::engine::DecodePaddingMode;
|
||||
|
||||
pub use base64_lib::Engine;
|
||||
pub use base64::Engine;
|
||||
|
||||
pub const BASE64: GeneralPurpose = GeneralPurpose::new(&STANDARD, CONFIG);
|
||||
|
||||
|
|
|
@ -1389,7 +1389,7 @@ mod tests {
|
|||
#[tokio::test]
|
||||
async fn test_token_scope_jwks() {
|
||||
use crate::dbs::capabilities::{Capabilities, NetTarget, Targets};
|
||||
use base64_lib::{engine::general_purpose::STANDARD_NO_PAD, Engine};
|
||||
use base64::{engine::general_purpose::STANDARD_NO_PAD, Engine};
|
||||
use jsonwebtoken::jwk::{Jwk, JwkSet};
|
||||
use rand::{distributions::Alphanumeric, Rng};
|
||||
use wiremock::matchers::{method, path};
|
||||
|
|
|
@ -13,30 +13,21 @@
|
|||
//! - `tikv`: [TiKV](https://github.com/tikv/tikv) a distributed, and transactional key-value database
|
||||
//! - `mem`: in-memory database
|
||||
mod cache;
|
||||
mod clock;
|
||||
mod ds;
|
||||
mod fdb;
|
||||
mod indxdb;
|
||||
mod kv;
|
||||
// pub(crate) for tests
|
||||
pub(crate) mod mem;
|
||||
mod mem;
|
||||
mod rocksdb;
|
||||
mod speedb;
|
||||
mod surrealkv;
|
||||
mod tikv;
|
||||
mod tx;
|
||||
|
||||
mod clock;
|
||||
pub(crate) mod lq_structs;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(any(
|
||||
feature = "kv-mem",
|
||||
feature = "kv-rocksdb",
|
||||
feature = "kv-speedb",
|
||||
feature = "kv-indxdb",
|
||||
feature = "kv-tikv",
|
||||
feature = "kv-fdb",
|
||||
feature = "kv-surrealkv"
|
||||
))]
|
||||
mod tests;
|
||||
|
||||
pub use self::ds::*;
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
#![cfg(any(
|
||||
feature = "kv-mem",
|
||||
feature = "kv-rocksdb",
|
||||
feature = "kv-speedb",
|
||||
feature = "kv-indxdb",
|
||||
feature = "kv-tikv",
|
||||
feature = "kv-fdb",
|
||||
feature = "kv-surrealkv"
|
||||
))]
|
||||
|
||||
use crate::kvs::clock::SizedClock;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#[macro_use]
|
||||
extern crate tracing;
|
||||
extern crate core;
|
||||
|
||||
#[macro_use]
|
||||
mod mac;
|
||||
|
@ -34,9 +33,6 @@ pub mod idx;
|
|||
pub mod key;
|
||||
#[doc(hidden)]
|
||||
pub mod kvs;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[doc(hidden)]
|
||||
pub mod obs;
|
||||
#[doc(hidden)]
|
||||
pub mod options;
|
||||
#[doc(hidden)]
|
||||
|
@ -44,6 +40,13 @@ pub mod rpc;
|
|||
#[doc(hidden)]
|
||||
pub mod syn;
|
||||
|
||||
#[cfg(feature = "ml")]
|
||||
#[doc(hidden)]
|
||||
pub use surrealml as ml;
|
||||
#[cfg(feature = "ml")]
|
||||
#[doc(hidden)]
|
||||
pub mod obs;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub mod test_helpers {
|
||||
pub use crate::vs::conv::to_u128_be;
|
||||
|
@ -58,13 +61,3 @@ pub mod channel {
|
|||
pub use channel::Receiver;
|
||||
pub use channel::Sender;
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "ml", not(feature = "ml2")))]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[doc(hidden)]
|
||||
pub use surrealml_core1 as ml;
|
||||
|
||||
#[cfg(feature = "ml2")]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[doc(hidden)]
|
||||
pub use surrealml_core2 as ml;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use base64_lib::{engine::general_purpose::STANDARD_NO_PAD, Engine};
|
||||
use base64::{engine::general_purpose::STANDARD_NO_PAD, Engine};
|
||||
use revision::revisioned;
|
||||
use serde::{
|
||||
de::{self, Visitor},
|
||||
|
|
|
@ -8,22 +8,22 @@ use revision::revisioned;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
use crate::iam::Action;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
use crate::ml::errors::error::SurrealError;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
use crate::ml::execution::compute::ModelComputation;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
use crate::ml::storage::surml_file::SurMlFile;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
use crate::sql::Permission;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
use futures::future::try_join_all;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
const ARGUMENTS: &str = "The model expects 1 argument. The argument can be either a number, an object, or an array of numbers.";
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, PartialOrd, Serialize, Deserialize, Store, Hash)]
|
||||
|
@ -50,7 +50,7 @@ impl fmt::Display for Model {
|
|||
}
|
||||
|
||||
impl Model {
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
pub(crate) async fn compute(
|
||||
&self,
|
||||
ctx: &Context<'_>,
|
||||
|
@ -211,7 +211,7 @@ impl Model {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(feature = "ml", feature = "ml2")))]
|
||||
#[cfg(not(feature = "ml"))]
|
||||
pub(crate) async fn compute(
|
||||
&self,
|
||||
_ctx: &Context<'_>,
|
||||
|
|
|
@ -319,11 +319,8 @@ impl Number {
|
|||
|
||||
pub fn to_decimal(&self) -> Decimal {
|
||||
match self {
|
||||
// #[allow(clippy::unnecessary_fallible_conversions)] // `Decimal::from` can panic
|
||||
// `clippy::unnecessary_fallible_conversions` not available on Rust < v1.75
|
||||
#[allow(warnings)]
|
||||
Number::Int(v) => Decimal::try_from(*v).unwrap_or_default(),
|
||||
Number::Float(v) => Decimal::try_from(*v).unwrap_or_default(),
|
||||
Number::Int(v) => Decimal::from(*v),
|
||||
Number::Float(v) => Decimal::from_f64(*v).unwrap_or_default(),
|
||||
Number::Decimal(v) => *v,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,14 +43,7 @@ impl ser::Serializer for Serializer {
|
|||
}
|
||||
|
||||
fn serialize_i128(self, value: i128) -> Result<Self::Ok, Error> {
|
||||
// TODO: Replace with native 128-bit integer support.
|
||||
// #[allow(clippy::unnecessary_fallible_conversions)] // `Decimal::from` can panic
|
||||
// `clippy::unnecessary_fallible_conversions` not available on Rust < v1.75
|
||||
#[allow(warnings)]
|
||||
match Decimal::try_from(value) {
|
||||
Ok(decimal) => Ok(decimal.into()),
|
||||
_ => Err(Error::TryFrom(value.to_string(), "Decimal")),
|
||||
}
|
||||
Ok(value.into())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -74,14 +67,7 @@ impl ser::Serializer for Serializer {
|
|||
}
|
||||
|
||||
fn serialize_u128(self, value: u128) -> Result<Self::Ok, Error> {
|
||||
// TODO: Replace with native 128-bit integer support.
|
||||
// #[allow(clippy::unnecessary_fallible_conversions)] // `Decimal::from` can panic
|
||||
// `clippy::unnecessary_fallible_conversions` not available on Rust < v1.75
|
||||
#[allow(warnings)]
|
||||
match Decimal::try_from(value) {
|
||||
Ok(decimal) => Ok(decimal.into()),
|
||||
_ => Err(Error::TryFrom(value.to_string(), "Decimal")),
|
||||
}
|
||||
Ok(value.into())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -22,7 +22,6 @@ use crate::sql::Strand;
|
|||
use crate::sql::Table;
|
||||
use crate::sql::Uuid;
|
||||
use map::SerializeValueMap;
|
||||
use rust_decimal::Decimal;
|
||||
use ser::cast::SerializeCast;
|
||||
use ser::edges::SerializeEdges;
|
||||
use ser::expression::SerializeExpression;
|
||||
|
@ -98,14 +97,7 @@ impl ser::Serializer for Serializer {
|
|||
}
|
||||
|
||||
fn serialize_i128(self, value: i128) -> Result<Self::Ok, Error> {
|
||||
// TODO: Replace with native 128-bit integer support.
|
||||
// #[allow(clippy::unnecessary_fallible_conversions)] // `Decimal::from` can panic
|
||||
// `clippy::unnecessary_fallible_conversions` not available on Rust < v1.75
|
||||
#[allow(warnings)]
|
||||
match Decimal::try_from(value) {
|
||||
Ok(decimal) => Ok(decimal.into()),
|
||||
_ => Err(Error::TryFrom(value.to_string(), "Decimal")),
|
||||
}
|
||||
Ok(value.into())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -129,14 +121,7 @@ impl ser::Serializer for Serializer {
|
|||
}
|
||||
|
||||
fn serialize_u128(self, value: u128) -> Result<Self::Ok, Error> {
|
||||
// TODO: replace with native 128-bit integer support.
|
||||
// #[allow(clippy::unnecessary_fallible_conversions)] // `Decimal::from` can panic
|
||||
// `clippy::unnecessary_fallible_conversions` not available on Rust < v1.75
|
||||
#[allow(warnings)]
|
||||
match Decimal::try_from(value) {
|
||||
Ok(decimal) => Ok(decimal.into()),
|
||||
_ => Err(Error::TryFrom(value.to_string(), "Decimal")),
|
||||
}
|
||||
Ok(value.into())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -1916,18 +1916,7 @@ impl Value {
|
|||
// Allow any decimal number
|
||||
Value::Number(v) if v.is_decimal() => Ok(v),
|
||||
// Attempt to convert an int number
|
||||
// #[allow(clippy::unnecessary_fallible_conversions)] // `Decimal::from` can panic
|
||||
// `clippy::unnecessary_fallible_conversions` not available on Rust < v1.75
|
||||
#[allow(warnings)]
|
||||
Value::Number(Number::Int(ref v)) => match Decimal::try_from(*v) {
|
||||
// The Int can be represented as a Decimal
|
||||
Ok(v) => Ok(Number::Decimal(v)),
|
||||
// This Int does not convert to a Decimal
|
||||
_ => Err(Error::ConvertTo {
|
||||
from: self,
|
||||
into: "decimal".into(),
|
||||
}),
|
||||
},
|
||||
Value::Number(Number::Int(ref v)) => Ok(Number::Decimal(Decimal::from(*v))),
|
||||
// Attempt to convert an float number
|
||||
Value::Number(Number::Float(ref v)) => match Decimal::try_from(*v) {
|
||||
// The Float can be represented as a Decimal
|
||||
|
|
109
lib/Cargo.toml
109
lib/Cargo.toml
|
@ -10,13 +10,7 @@ description = "A scalable, distributed, collaborative, document-graph database,
|
|||
repository = "https://github.com/surrealdb/surrealdb"
|
||||
homepage = "https://github.com/surrealdb/surrealdb"
|
||||
documentation = "https://docs.rs/surrealdb/"
|
||||
keywords = [
|
||||
"database",
|
||||
"embedded-database",
|
||||
"key-value",
|
||||
"key-value-store",
|
||||
"kv-store",
|
||||
]
|
||||
keywords = ["database", "embedded-database", "key-value", "key-value-store", "kv-store"]
|
||||
categories = ["database-implementations", "data-structures", "embedded"]
|
||||
license-file = "../LICENSE"
|
||||
resolver = "2"
|
||||
|
@ -26,51 +20,50 @@ resolver = "2"
|
|||
default = ["protocol-ws", "rustls"]
|
||||
protocol-http = ["dep:reqwest", "dep:tokio-util"]
|
||||
protocol-ws = ["dep:tokio-tungstenite", "dep:trice", "tokio/time"]
|
||||
kv-mem = ["surrealdb-core1/kv-mem", "surrealdb-core2/kv-mem", "tokio/time"]
|
||||
kv-indxdb = ["surrealdb-core1/kv-indxdb", "surrealdb-core2/kv-indxdb"]
|
||||
kv-speedb = ["surrealdb-core1/kv-speedb", "surrealdb-core2/kv-speedb", "tokio/time"]
|
||||
kv-rocksdb = ["surrealdb-core1/kv-rocksdb", "surrealdb-core2/kv-rocksdb", "tokio/time"]
|
||||
kv-tikv = ["surrealdb-core1/kv-tikv", "surrealdb-core2/kv-tikv"]
|
||||
kv-fdb-5_1 = ["surrealdb-core1/kv-fdb-5_1", "surrealdb-core2/kv-fdb-5_1", "kv-fdb"]
|
||||
kv-fdb-5_2 = ["surrealdb-core1/kv-fdb-5_2", "surrealdb-core2/kv-fdb-5_2", "kv-fdb"]
|
||||
kv-fdb-6_0 = ["surrealdb-core1/kv-fdb-6_0", "surrealdb-core2/kv-fdb-6_0", "kv-fdb"]
|
||||
kv-fdb-6_1 = ["surrealdb-core1/kv-fdb-6_1", "surrealdb-core2/kv-fdb-6_1", "kv-fdb"]
|
||||
kv-fdb-6_2 = ["surrealdb-core1/kv-fdb-6_2", "surrealdb-core2/kv-fdb-6_2", "kv-fdb"]
|
||||
kv-fdb-6_3 = ["surrealdb-core1/kv-fdb-6_3", "surrealdb-core2/kv-fdb-6_3", "kv-fdb"]
|
||||
kv-fdb-7_0 = ["surrealdb-core1/kv-fdb-7_0", "surrealdb-core2/kv-fdb-7_0", "kv-fdb"]
|
||||
kv-fdb-7_1 = ["surrealdb-core1/kv-fdb-7_1", "surrealdb-core2/kv-fdb-7_1", "kv-fdb"]
|
||||
kv-surrealkv = ["surrealdb-core1/kv-surrealkv", "surrealdb-core2/kv-surrealkv", "tokio/time"]
|
||||
scripting = ["surrealdb-core1/scripting", "surrealdb-core2/scripting"]
|
||||
http = ["surrealdb-core1/http", "surrealdb-core2/http"]
|
||||
kv-mem = ["surrealdb-core/kv-mem", "tokio/time"]
|
||||
kv-indxdb = ["surrealdb-core/kv-indxdb"]
|
||||
kv-speedb = ["surrealdb-core/kv-speedb", "tokio/time"]
|
||||
kv-rocksdb = ["surrealdb-core/kv-rocksdb", "tokio/time"]
|
||||
kv-tikv = ["surrealdb-core/kv-tikv"]
|
||||
kv-fdb-5_1 = ["surrealdb-core/kv-fdb-5_1", "kv-fdb"]
|
||||
kv-fdb-5_2 = ["surrealdb-core/kv-fdb-5_2", "kv-fdb"]
|
||||
kv-fdb-6_0 = ["surrealdb-core/kv-fdb-6_0", "kv-fdb"]
|
||||
kv-fdb-6_1 = ["surrealdb-core/kv-fdb-6_1", "kv-fdb"]
|
||||
kv-fdb-6_2 = ["surrealdb-core/kv-fdb-6_2", "kv-fdb"]
|
||||
kv-fdb-6_3 = ["surrealdb-core/kv-fdb-6_3", "kv-fdb"]
|
||||
kv-fdb-7_0 = ["surrealdb-core/kv-fdb-7_0", "kv-fdb"]
|
||||
kv-fdb-7_1 = ["surrealdb-core/kv-fdb-7_1", "kv-fdb"]
|
||||
kv-surrealkv = ["surrealdb-core/kv-surrealkv", "tokio/time"]
|
||||
scripting = ["surrealdb-core/scripting"]
|
||||
http = ["surrealdb-core/http"]
|
||||
native-tls = [
|
||||
"dep:native-tls",
|
||||
"reqwest?/native-tls",
|
||||
"tokio-tungstenite?/native-tls",
|
||||
"dep:native-tls",
|
||||
"reqwest?/native-tls",
|
||||
"tokio-tungstenite?/native-tls",
|
||||
]
|
||||
rustls = [
|
||||
"dep:rustls",
|
||||
"reqwest?/rustls-tls",
|
||||
"tokio-tungstenite?/rustls-tls-webpki-roots",
|
||||
"dep:rustls",
|
||||
"reqwest?/rustls-tls",
|
||||
"tokio-tungstenite?/rustls-tls-webpki-roots",
|
||||
]
|
||||
ml = ["surrealdb-core1/ml", "surrealdb-core2/ml"]
|
||||
jwks = ["surrealdb-core2/jwks", "sql2"]
|
||||
arbitrary = ["surrealdb-core1/arbitrary", "surrealdb-core2/arbitrary"]
|
||||
sql2 = ["dep:surrealdb-core2"]
|
||||
parser2 = ["surrealdb-core1/experimental-parser", "surrealdb-core2/experimental-parser"]
|
||||
ml = ["surrealdb-core/ml"]
|
||||
jwks = ["surrealdb-core/jwks"]
|
||||
arbitrary = ["surrealdb-core/arbitrary"]
|
||||
parser2 = ["surrealdb-core/experimental-parser"]
|
||||
# Private features
|
||||
kv-fdb = ["tokio/time"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
features = [
|
||||
"protocol-ws",
|
||||
"protocol-http",
|
||||
"kv-mem",
|
||||
"kv-rocksdb",
|
||||
"rustls",
|
||||
"native-tls",
|
||||
"http",
|
||||
"scripting",
|
||||
"protocol-ws",
|
||||
"protocol-http",
|
||||
"kv-mem",
|
||||
"kv-rocksdb",
|
||||
"rustls",
|
||||
"native-tls",
|
||||
"http",
|
||||
"scripting",
|
||||
]
|
||||
targets = []
|
||||
|
||||
|
@ -88,9 +81,9 @@ native-tls = { version = "0.2.11", optional = true }
|
|||
once_cell = "1.18.0"
|
||||
path-clean = "1.0.1"
|
||||
reqwest = { version = "0.11.22", default-features = false, features = [
|
||||
"json",
|
||||
"stream",
|
||||
"multipart",
|
||||
"json",
|
||||
"stream",
|
||||
"multipart",
|
||||
], optional = true }
|
||||
revision = "0.5.0"
|
||||
rust_decimal = { version = "1.33.1", features = ["maths", "serde-str"] }
|
||||
|
@ -98,8 +91,7 @@ rustls = { version = "0.21.10", optional = true }
|
|||
semver = { version = "1.0.20", features = ["serde"] }
|
||||
serde = { version = "1.0.193", features = ["derive"] }
|
||||
serde_json = "1.0.108"
|
||||
surrealdb-core1 = { version = "1", default-features = false, package = "surrealdb-core" }
|
||||
surrealdb-core2 = { version = "=2.0.0-1.5.0", default-features = false, path = "../core", package = "surrealdb-core", optional = true }
|
||||
surrealdb-core = { version = "=2.0.0-1.5.0", default-features = false, path = "../core" }
|
||||
thiserror = "1.0.50"
|
||||
tokio-util = { version = "0.7.10", optional = true, features = ["compat"] }
|
||||
tracing = "0.1.40"
|
||||
|
@ -124,24 +116,27 @@ wiremock = "0.5.22"
|
|||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
pharos = "0.5.3"
|
||||
ring = { version = "0.17.7", features = ["wasm32_unknown_unknown_js"] } # Make ring-based dependencies work on Wasm
|
||||
tokio = { version = "1.34.0", default-features = false, features = ["rt", "sync"] }
|
||||
ring = { version = "0.17.7", features = ["wasm32_unknown_unknown_js"] }
|
||||
tokio = { version = "1.34.0", default-features = false, features = [
|
||||
"rt",
|
||||
"sync",
|
||||
] }
|
||||
uuid = { version = "1.6.1", features = ["serde", "js", "v4", "v7"] }
|
||||
wasm-bindgen-futures = "0.4.39"
|
||||
wasmtimer = { version = "0.2.0", default-features = false, features = [
|
||||
"tokio",
|
||||
"tokio",
|
||||
] }
|
||||
ws_stream_wasm = "0.7.4"
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
tokio = { version = "1.34.0", default-features = false, features = [
|
||||
"macros",
|
||||
"io-util",
|
||||
"io-std",
|
||||
"fs",
|
||||
"rt-multi-thread",
|
||||
"time",
|
||||
"sync",
|
||||
"macros",
|
||||
"io-util",
|
||||
"io-std",
|
||||
"fs",
|
||||
"rt-multi-thread",
|
||||
"time",
|
||||
"sync",
|
||||
] }
|
||||
tokio-tungstenite = { version = "0.20.1", optional = true }
|
||||
uuid = { version = "1.6.1", features = ["serde", "v4", "v7"] }
|
||||
|
|
|
@ -47,28 +47,28 @@ use crate::api::Surreal;
|
|||
use crate::dbs::Notification;
|
||||
use crate::dbs::Response;
|
||||
use crate::dbs::Session;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::iam::check::check_ns_db;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::iam::Action;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::iam::ResourceKind;
|
||||
use crate::kvs::Datastore;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::kvs::{LockType, TransactionType};
|
||||
use crate::method::Stats;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::ml::storage::surml_file::SurMlFile;
|
||||
use crate::opt::IntoEndpoint;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::sql::statements::DefineModelStatement;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::sql::statements::DefineStatement;
|
||||
use crate::sql::statements::KillStatement;
|
||||
|
@ -77,7 +77,7 @@ use crate::sql::Statement;
|
|||
use crate::sql::Uuid;
|
||||
use crate::sql::Value;
|
||||
use channel::Sender;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use futures::StreamExt;
|
||||
use indexmap::IndexMap;
|
||||
|
@ -88,7 +88,6 @@ use std::mem;
|
|||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
#[cfg(feature = "sql2")]
|
||||
use std::time::Duration;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use tokio::fs::OpenOptions;
|
||||
|
@ -99,7 +98,6 @@ use tokio::io::AsyncReadExt;
|
|||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
||||
#[cfg(feature = "sql2")]
|
||||
const DEFAULT_TICK_INTERVAL: Duration = Duration::from_secs(10);
|
||||
|
||||
/// In-memory database
|
||||
|
@ -445,7 +443,7 @@ async fn export(
|
|||
ml_config: Option<MlConfig>,
|
||||
) -> Result<()> {
|
||||
match ml_config {
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
Some(MlConfig::Export {
|
||||
name,
|
||||
version,
|
||||
|
@ -722,7 +720,7 @@ async fn router(
|
|||
}
|
||||
};
|
||||
let responses = match param.ml_config {
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
Some(MlConfig::Import) => {
|
||||
// Ensure a NS and DB are set
|
||||
let (nsv, dbv) = check_ns_db(session)?;
|
||||
|
|
|
@ -16,7 +16,6 @@ use crate::iam::Level;
|
|||
use crate::kvs::Datastore;
|
||||
use crate::opt::auth::Root;
|
||||
use crate::opt::WaitFor;
|
||||
#[cfg(feature = "sql2")]
|
||||
use crate::options::EngineOptions;
|
||||
use flume::Receiver;
|
||||
use flume::Sender;
|
||||
|
@ -161,7 +160,6 @@ pub(crate) fn router(
|
|||
let mut live_queries = HashMap::new();
|
||||
let mut session = Session::default().with_rt(true);
|
||||
|
||||
#[cfg(feature = "sql2")]
|
||||
let opt = {
|
||||
let mut engine_options = EngineOptions::default();
|
||||
engine_options.tick_interval = address
|
||||
|
@ -170,11 +168,7 @@ pub(crate) fn router(
|
|||
.unwrap_or(crate::api::engine::local::DEFAULT_TICK_INTERVAL);
|
||||
engine_options
|
||||
};
|
||||
let (tasks, task_chans) = start_tasks(
|
||||
#[cfg(feature = "sql2")]
|
||||
&opt,
|
||||
kvs.clone(),
|
||||
);
|
||||
let (tasks, task_chans) = start_tasks(&opt, kvs.clone());
|
||||
|
||||
let mut notifications = kvs.notifications();
|
||||
let notification_stream = poll_fn(move |cx| match &mut notifications {
|
||||
|
|
|
@ -7,7 +7,7 @@ pub(crate) mod wasm;
|
|||
|
||||
use crate::api::conn::DbResponse;
|
||||
use crate::api::conn::Method;
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::api::conn::MlConfig;
|
||||
use crate::api::conn::Param;
|
||||
|
@ -208,7 +208,6 @@ async fn query(request: RequestBuilder) -> Result<QueryResponse> {
|
|||
Status::Err => {
|
||||
map.insert(index, (stats, Err(Error::Query(value.as_raw_string()).into())));
|
||||
}
|
||||
#[cfg(feature = "sql2")]
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
@ -534,7 +533,7 @@ async fn router(
|
|||
#[cfg(not(target_arch = "wasm32"))]
|
||||
Method::Export => {
|
||||
let path = match param.ml_config {
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
Some(MlConfig::Export {
|
||||
name,
|
||||
version,
|
||||
|
@ -552,7 +551,7 @@ async fn router(
|
|||
#[cfg(not(target_arch = "wasm32"))]
|
||||
Method::Import => {
|
||||
let path = match param.ml_config {
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
Some(MlConfig::Import) => base_url.join("ml/import")?,
|
||||
_ => base_url.join(Method::Import.as_str())?,
|
||||
};
|
||||
|
|
|
@ -135,7 +135,6 @@ impl DbResponse {
|
|||
(stats, Err(Error::Query(response.result.as_raw_string()).into())),
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "sql2")]
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ use tokio::task::JoinHandle;
|
|||
use crate::dbs::Options;
|
||||
use crate::fflags::FFLAGS;
|
||||
use crate::kvs::Datastore;
|
||||
#[cfg(feature = "sql2")]
|
||||
use crate::options::EngineOptions;
|
||||
|
||||
use crate::engine::IntervalStream;
|
||||
|
@ -39,22 +38,13 @@ impl Tasks {
|
|||
pub async fn resolve(self) -> Result<(), RootError> {
|
||||
self.nd.await.map_err(|e| {
|
||||
error!("Node agent task failed: {}", e);
|
||||
#[cfg(not(feature = "sql2"))]
|
||||
let inner_err = crate::err::Error::Unreachable(
|
||||
"This feature won't go live with sql1, so delete this branching",
|
||||
);
|
||||
#[cfg(feature = "sql2")]
|
||||
let inner_err = crate::err::Error::NodeAgent("node task failed and has been logged");
|
||||
RootError::Db(inner_err)
|
||||
})?;
|
||||
self.lq.await.map_err(|e| {
|
||||
error!("Live query task failed: {}", e);
|
||||
#[cfg(not(feature = "sql2"))]
|
||||
let inner_err = crate::err::Error::Unreachable(
|
||||
"This feature won't go live with sql1, so delete this branching",
|
||||
);
|
||||
#[cfg(feature = "sql2")]
|
||||
let inner_err = crate::err::Error::NodeAgent("live query task failed and has been logged");
|
||||
let inner_err =
|
||||
crate::err::Error::NodeAgent("live query task failed and has been logged");
|
||||
RootError::Db(inner_err)
|
||||
})?;
|
||||
Ok(())
|
||||
|
@ -62,20 +52,9 @@ impl Tasks {
|
|||
}
|
||||
|
||||
/// Starts tasks that are required for the correct running of the engine
|
||||
pub fn start_tasks(
|
||||
#[cfg(feature = "sql2")] opt: &EngineOptions,
|
||||
dbs: Arc<Datastore>,
|
||||
) -> (Tasks, [Sender<()>; 2]) {
|
||||
let nd = init(
|
||||
#[cfg(feature = "sql2")]
|
||||
opt,
|
||||
dbs.clone(),
|
||||
);
|
||||
let lq = live_query_change_feed(
|
||||
#[cfg(feature = "sql2")]
|
||||
opt,
|
||||
dbs,
|
||||
);
|
||||
pub fn start_tasks(opt: &EngineOptions, dbs: Arc<Datastore>) -> (Tasks, [Sender<()>; 2]) {
|
||||
let nd = init(opt, dbs.clone());
|
||||
let lq = live_query_change_feed(opt, dbs);
|
||||
let cancellation_channels = [nd.1, lq.1];
|
||||
(
|
||||
Tasks {
|
||||
|
@ -92,16 +71,9 @@ pub fn start_tasks(
|
|||
//
|
||||
// This function needs to be called before after the dbs::init and before the net::init functions.
|
||||
// It needs to be before net::init because the net::init function blocks until the web server stops.
|
||||
fn init(
|
||||
#[cfg(feature = "sql2")] opt: &EngineOptions,
|
||||
dbs: Arc<Datastore>,
|
||||
) -> (FutureTask, Sender<()>) {
|
||||
#[cfg(feature = "sql2")]
|
||||
fn init(opt: &EngineOptions, dbs: Arc<Datastore>) -> (FutureTask, Sender<()>) {
|
||||
let _init = crate::dbs::LoggingLifecycle::new("node agent initialisation".to_string());
|
||||
#[cfg(feature = "sql2")]
|
||||
let tick_interval = opt.tick_interval;
|
||||
#[cfg(not(feature = "sql2"))]
|
||||
let tick_interval = Duration::from_secs(1);
|
||||
|
||||
trace!("Ticker interval is {:?}", tick_interval);
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
@ -113,7 +85,6 @@ fn init(
|
|||
let (tx, rx) = flume::bounded(1);
|
||||
|
||||
let _fut = spawn_future(async move {
|
||||
#[cfg(feature = "sql2")]
|
||||
let _lifecycle = crate::dbs::LoggingLifecycle::new("heartbeat task".to_string());
|
||||
let ticker = interval_ticker(tick_interval).await;
|
||||
let streams = (
|
||||
|
@ -142,14 +113,8 @@ fn init(
|
|||
}
|
||||
|
||||
// Start live query on change feeds notification processing
|
||||
fn live_query_change_feed(
|
||||
#[cfg(feature = "sql2")] opt: &EngineOptions,
|
||||
dbs: Arc<Datastore>,
|
||||
) -> (FutureTask, Sender<()>) {
|
||||
#[cfg(feature = "sql2")]
|
||||
fn live_query_change_feed(opt: &EngineOptions, dbs: Arc<Datastore>) -> (FutureTask, Sender<()>) {
|
||||
let tick_interval = opt.tick_interval;
|
||||
#[cfg(not(feature = "sql2"))]
|
||||
let tick_interval = Duration::from_secs(1);
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let completed_status = Arc::new(AtomicBool::new(false));
|
||||
|
@ -160,7 +125,6 @@ fn live_query_change_feed(
|
|||
let (tx, rx) = flume::bounded(1);
|
||||
|
||||
let _fut = spawn_future(async move {
|
||||
#[cfg(feature = "sql2")]
|
||||
let _lifecycle = crate::dbs::LoggingLifecycle::new("live query agent task".to_string());
|
||||
if !FFLAGS.change_feed_live_queries.enabled() {
|
||||
// TODO verify test fails since return without completion
|
||||
|
@ -212,20 +176,14 @@ async fn interval_ticker(interval: Duration) -> IntervalStream {
|
|||
mod test {
|
||||
use crate::engine::tasks::start_tasks;
|
||||
use crate::kvs::Datastore;
|
||||
#[cfg(feature = "sql2")]
|
||||
use crate::options::EngineOptions;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[test_log::test(tokio::test)]
|
||||
pub async fn tasks_complete() {
|
||||
#[cfg(feature = "sql2")]
|
||||
let opt = EngineOptions::default();
|
||||
let dbs = Arc::new(Datastore::new("memory").await.unwrap());
|
||||
let (val, chans) = start_tasks(
|
||||
#[cfg(feature = "sql2")]
|
||||
&opt,
|
||||
dbs.clone(),
|
||||
);
|
||||
let (val, chans) = start_tasks(&opt, dbs.clone());
|
||||
for chan in chans {
|
||||
chan.send(()).unwrap();
|
||||
}
|
||||
|
|
|
@ -110,21 +110,14 @@
|
|||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![cfg_attr(test, deny(warnings))]
|
||||
|
||||
#[cfg(all(target_arch = "wasm32", feature = "ml"))]
|
||||
compile_error!("The `ml` feature is not supported on the `wasm32` architecture.");
|
||||
|
||||
#[cfg(all(not(surrealdb_unstable), feature = "parser2"))]
|
||||
compile_error!(
|
||||
"`parser2` is currently unstable. You need to enable the `surrealdb_unstable` flag to use it."
|
||||
);
|
||||
|
||||
#[cfg(all(not(surrealdb_unstable), feature = "ml2"))]
|
||||
compile_error!(
|
||||
"`ml2` is currently unstable. You need to enable the `surrealdb_unstable` flag to use it."
|
||||
);
|
||||
|
||||
#[cfg(all(not(surrealdb_unstable), feature = "kv-surrealkv"))]
|
||||
compile_error!(
|
||||
"`kv-surrealkv` is currently unstable. You need to enable the `surrealdb_unstable` flag to use it."
|
||||
);
|
||||
|
||||
#[macro_use]
|
||||
extern crate tracing;
|
||||
|
||||
|
@ -149,13 +142,8 @@ pub use api::Response;
|
|||
pub use api::Result;
|
||||
#[doc(inline)]
|
||||
pub use api::Surreal;
|
||||
|
||||
#[cfg(not(feature = "sql2"))]
|
||||
#[doc(inline)]
|
||||
pub use surrealdb_core1::*;
|
||||
#[cfg(feature = "sql2")]
|
||||
#[doc(inline)]
|
||||
pub use surrealdb_core2::*;
|
||||
pub use surrealdb_core::*;
|
||||
|
||||
use uuid::Uuid;
|
||||
|
||||
|
@ -191,7 +179,6 @@ impl From<dbs::Action> for Action {
|
|||
dbs::Action::Create => Self::Create,
|
||||
dbs::Action::Update => Self::Update,
|
||||
dbs::Action::Delete => Self::Delete,
|
||||
#[cfg(feature = "sql2")]
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ async fn export_import() {
|
|||
}
|
||||
|
||||
#[test_log::test(tokio::test)]
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
async fn ml_export_import() {
|
||||
let (permit, db) = new_db().await;
|
||||
let db_name = Ulid::new().to_string();
|
||||
|
|
|
@ -11,7 +11,7 @@ use surrealdb::kvs::Datastore;
|
|||
use surrealdb::kvs::LockType::Optimistic;
|
||||
use surrealdb::kvs::TransactionType::Write;
|
||||
use surrealdb::sql::Value;
|
||||
use surrealdb_core2::test_helpers::{generate_versionstamp_sequences, to_u128_be};
|
||||
use surrealdb_core::test_helpers::{generate_versionstamp_sequences, to_u128_be};
|
||||
|
||||
mod helpers;
|
||||
|
||||
|
@ -180,7 +180,6 @@ async fn database_change_feeds() -> Result<(), Error> {
|
|||
current_time += 1;
|
||||
dbs.tick_at(current_time).await?;
|
||||
let mut tx = dbs.transaction(Write, Optimistic).await?;
|
||||
#[cfg(feature = "sql2")]
|
||||
tx.print_all().await;
|
||||
tx.cancel().await?;
|
||||
|
||||
|
|
|
@ -1219,7 +1219,6 @@ async fn define_statement_index_multiple_unique_embedded_multiple() -> Result<()
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn define_statement_analyzer() -> Result<(), Error> {
|
||||
let sql = r#"
|
||||
DEFINE ANALYZER english TOKENIZERS blank,class FILTERS lowercase,snowball(english);
|
||||
|
@ -2175,7 +2174,6 @@ async fn redefining_existing_analyzer_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_analyzer_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE ANALYZER IF NOT EXISTS example TOKENIZERS blank;
|
||||
|
@ -2216,7 +2214,6 @@ async fn redefining_existing_database_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_database_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE DATABASE IF NOT EXISTS example;
|
||||
|
@ -2257,7 +2254,6 @@ async fn redefining_existing_event_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_event_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE EVENT IF NOT EXISTS example ON example THEN {};
|
||||
|
@ -2298,7 +2294,6 @@ async fn redefining_existing_field_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_field_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE FIELD IF NOT EXISTS example ON example;
|
||||
|
@ -2339,7 +2334,6 @@ async fn redefining_existing_function_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_function_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE FUNCTION IF NOT EXISTS fn::example() {};
|
||||
|
@ -2380,7 +2374,6 @@ async fn redefining_existing_index_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_index_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE INDEX IF NOT EXISTS example ON example FIELDS example;
|
||||
|
@ -2421,7 +2414,6 @@ async fn redefining_existing_namespace_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_namespace_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE NAMESPACE IF NOT EXISTS example;
|
||||
|
@ -2462,7 +2454,6 @@ async fn redefining_existing_param_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_param_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE PARAM IF NOT EXISTS $example VALUE 123;
|
||||
|
@ -2503,7 +2494,6 @@ async fn redefining_existing_scope_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_scope_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE SCOPE IF NOT EXISTS example;
|
||||
|
@ -2544,7 +2534,6 @@ async fn redefining_existing_table_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_table_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE TABLE IF NOT EXISTS example;
|
||||
|
@ -2585,7 +2574,6 @@ async fn redefining_existing_token_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_token_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE TOKEN IF NOT EXISTS example ON SCOPE example TYPE HS512 VALUE \"example\";
|
||||
|
@ -2626,7 +2614,6 @@ async fn redefining_existing_user_should_not_error() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn redefining_existing_user_with_if_not_exists_should_error() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE USER IF NOT EXISTS example ON ROOT PASSWORD \"example\" ROLES OWNER;
|
||||
|
@ -2647,7 +2634,6 @@ async fn redefining_existing_user_with_if_not_exists_should_error() -> Result<()
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn define_table_relation() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE TABLE likes TYPE RELATION;
|
||||
|
|
|
@ -866,7 +866,6 @@ async fn field_definition_edge_permissions() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn field_definition_readonly() -> Result<(), Error> {
|
||||
let sql = "
|
||||
DEFINE TABLE person SCHEMAFULL;
|
||||
|
|
|
@ -3398,7 +3398,6 @@ async fn function_string_ends_with() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[test_log::test(tokio::test)]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn function_search_analyzer() -> Result<(), Error> {
|
||||
let sql = r#"
|
||||
DEFINE FUNCTION fn::stripHtml($html: string) {
|
||||
|
@ -3424,7 +3423,6 @@ async fn function_search_analyzer() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[test_log::test(tokio::test)]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn function_search_analyzer_invalid_arguments() -> Result<(), Error> {
|
||||
let sql = r#"
|
||||
DEFINE FUNCTION fn::unsupportedFunction() {
|
||||
|
@ -3457,7 +3455,6 @@ async fn function_search_analyzer_invalid_arguments() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[test_log::test(tokio::test)]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn function_search_analyzer_invalid_return_type() -> Result<(), Error> {
|
||||
let sql = r#"
|
||||
DEFINE FUNCTION fn::unsupportedReturnedType($html: string) {
|
||||
|
@ -3490,7 +3487,6 @@ async fn function_search_analyzer_invalid_return_type() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[test_log::test(tokio::test)]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn function_search_analyzer_invalid_function_name() -> Result<(), Error> {
|
||||
let sql = r#"
|
||||
DEFINE ANALYZER htmlAnalyzer FUNCTION fn::doesNotExist TOKENIZERS blank,class;
|
||||
|
|
|
@ -125,13 +125,11 @@ async fn remove_statement_index() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
// Every index store cache has been removed
|
||||
#[cfg(feature = "sql2")]
|
||||
assert!(dbs.index_store().is_empty().await);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_table_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE TABLE foo;
|
||||
|
@ -148,7 +146,6 @@ async fn should_error_when_remove_and_table_does_not_exist() -> Result<(), Error
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_table_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE TABLE IF EXISTS foo;
|
||||
|
@ -165,7 +162,6 @@ async fn should_not_error_when_remove_table_if_exists() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_analyzer_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE ANALYZER foo;
|
||||
|
@ -182,7 +178,6 @@ async fn should_error_when_remove_and_analyzer_does_not_exist() -> Result<(), Er
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_analyzer_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE ANALYZER IF EXISTS foo;
|
||||
|
@ -199,7 +194,6 @@ async fn should_not_error_when_remove_analyzer_if_exists() -> Result<(), Error>
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_database_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE DATABASE foo;
|
||||
|
@ -216,7 +210,6 @@ async fn should_error_when_remove_and_database_does_not_exist() -> Result<(), Er
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_database_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE DATABASE IF EXISTS foo;
|
||||
|
@ -233,7 +226,6 @@ async fn should_not_error_when_remove_database_if_exists() -> Result<(), Error>
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_event_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE EVENT foo ON bar;
|
||||
|
@ -250,7 +242,6 @@ async fn should_error_when_remove_and_event_does_not_exist() -> Result<(), Error
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_event_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE EVENT IF EXISTS foo ON bar;
|
||||
|
@ -267,7 +258,6 @@ async fn should_not_error_when_remove_event_if_exists() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_field_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE FIELD foo ON bar;
|
||||
|
@ -284,7 +274,6 @@ async fn should_error_when_remove_and_field_does_not_exist() -> Result<(), Error
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_field_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE FIELD IF EXISTS foo ON bar;
|
||||
|
@ -301,7 +290,6 @@ async fn should_not_error_when_remove_field_if_exists() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_function_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE FUNCTION fn::foo;
|
||||
|
@ -318,7 +306,6 @@ async fn should_error_when_remove_and_function_does_not_exist() -> Result<(), Er
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_function_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE FUNCTION IF EXISTS fn::foo;
|
||||
|
@ -335,7 +322,6 @@ async fn should_not_error_when_remove_function_if_exists() -> Result<(), Error>
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_index_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE INDEX foo ON bar;
|
||||
|
@ -352,7 +338,6 @@ async fn should_error_when_remove_and_index_does_not_exist() -> Result<(), Error
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_index_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE INDEX IF EXISTS foo ON bar;
|
||||
|
@ -369,7 +354,6 @@ async fn should_not_error_when_remove_index_if_exists() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_namespace_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE NAMESPACE foo;
|
||||
|
@ -386,7 +370,6 @@ async fn should_error_when_remove_and_namespace_does_not_exist() -> Result<(), E
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_namespace_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE NAMESPACE IF EXISTS foo;
|
||||
|
@ -403,7 +386,6 @@ async fn should_not_error_when_remove_namespace_if_exists() -> Result<(), Error>
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_param_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE PARAM $foo;
|
||||
|
@ -420,7 +402,6 @@ async fn should_error_when_remove_and_param_does_not_exist() -> Result<(), Error
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_param_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE PARAM IF EXISTS $foo;
|
||||
|
@ -437,7 +418,6 @@ async fn should_not_error_when_remove_param_if_exists() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_scope_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE SCOPE foo;
|
||||
|
@ -454,7 +434,6 @@ async fn should_error_when_remove_and_scope_does_not_exist() -> Result<(), Error
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_scope_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE SCOPE IF EXISTS foo;
|
||||
|
@ -471,7 +450,6 @@ async fn should_not_error_when_remove_scope_if_exists() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_token_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE TOKEN foo ON NAMESPACE;
|
||||
|
@ -488,7 +466,6 @@ async fn should_error_when_remove_and_token_does_not_exist() -> Result<(), Error
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_token_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE TOKEN IF EXISTS foo ON NAMESPACE;
|
||||
|
@ -505,7 +482,6 @@ async fn should_not_error_when_remove_token_if_exists() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_error_when_remove_and_user_does_not_exist() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE USER foo ON ROOT;
|
||||
|
@ -522,7 +498,6 @@ async fn should_error_when_remove_and_user_does_not_exist() -> Result<(), Error>
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(feature = "sql2")]
|
||||
async fn should_not_error_when_remove_user_if_exists() -> Result<(), Error> {
|
||||
let sql = "
|
||||
REMOVE USER IF EXISTS foo ON ROOT;
|
||||
|
|
|
@ -17,7 +17,7 @@ mod sync;
|
|||
mod tracer;
|
||||
mod version;
|
||||
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
mod ml;
|
||||
|
||||
use crate::cli::CF;
|
||||
|
@ -178,7 +178,7 @@ pub async fn init(ct: CancellationToken) -> Result<(), Error> {
|
|||
.merge(signup::router())
|
||||
.merge(key::router());
|
||||
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
let axum_app = axum_app.merge(ml::router());
|
||||
|
||||
let axum_app = axum_app.layer(service);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUST_LOG=warn cargo make ci-ml-integration
|
||||
mod common;
|
||||
|
||||
#[cfg(any(feature = "ml", feature = "ml2"))]
|
||||
#[cfg(feature = "ml")]
|
||||
mod ml_integration {
|
||||
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue