diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 23b64eece..65e19f332 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -38,7 +38,7 @@ jobs: run: cargo build --verbose - name: Test env: - RUST_LOG: ${{ runner.debug && 'limbo_core::storage=trace' || '' }} + RUST_LOG: ${{ runner.debug && 'turso_core::storage=trace' || '' }} run: cargo test --verbose timeout-minutes: 20 diff --git a/Cargo.lock b/Cargo.lock index 8e399bca2..29f9a8a28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -520,7 +520,6 @@ dependencies = [ "anyhow", "assert_cmd", "env_logger 0.10.2", - "limbo_core", "log", "rand 0.9.0", "rand_chacha 0.9.0", @@ -530,6 +529,7 @@ dependencies = [ "test-log", "tracing", "tracing-subscriber", + "turso_core", ] [[package]] @@ -1724,17 +1724,17 @@ dependencies = [ name = "limbo" version = "0.1.0-pre.2" dependencies = [ - "limbo_core", "tempfile", "thiserror 2.0.12", "tokio", + "turso_core", ] [[package]] name = "limbo-go" version = "0.1.0-pre.2" dependencies = [ - "limbo_core", + "turso_core", ] [[package]] @@ -1742,8 +1742,8 @@ name = "limbo-java" version = "0.1.0-pre.2" dependencies = [ "jni", - "limbo_core", "thiserror 2.0.12", + "turso_core", ] [[package]] @@ -1753,7 +1753,7 @@ dependencies = [ "console_error_panic_hook", "getrandom 0.2.15", "js-sys", - "limbo_core", + "turso_core", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -1767,65 +1767,6 @@ dependencies = [ "mimalloc", ] -[[package]] -name = "limbo_core" -version = "0.1.0-pre.2" -dependencies = [ - "bitflags 2.9.0", - "built", - "cfg_block", - "chrono", - "criterion", - "crossbeam-skiplist", - "env_logger 0.11.7", - "fallible-iterator", - "getrandom 0.2.15", - "hex", - "io-uring", - "julian_day_converter", - "libc", - "libloading", - "libm", - "limbo_completion", - "limbo_crypto", - "limbo_csv", - "limbo_ext", - "limbo_ipaddr", - "limbo_macros", - "limbo_percentile", - "limbo_regexp", - "limbo_series", - "limbo_sqlite3_parser", - "limbo_time", - "limbo_uuid", - "lru", - "miette", - "mimalloc", - "parking_lot", - "paste", - "polling", - "pprof", - "quickcheck", - "quickcheck_macros", - "rand 0.8.5", - "rand_chacha 0.9.0", - "regex", - "regex-syntax 0.8.5", - "rstest", - "rusqlite", - "rustix 1.0.7", - "ryu", - "serde", - "sorted-vec", - "strum", - "strum_macros", - "tempfile", - "test-log", - "thiserror 1.0.69", - "tracing", - "uncased", -] - [[package]] name = "limbo_crypto" version = "0.1.0-pre.2" @@ -1925,7 +1866,6 @@ dependencies = [ "dirs 6.0.0", "env_logger 0.10.2", "hex", - "limbo_core", "limbo_sqlite3_parser", "log", "notify", @@ -1938,6 +1878,7 @@ dependencies = [ "serde_json", "tracing", "tracing-subscriber", + "turso_core", ] [[package]] @@ -1946,11 +1887,11 @@ version = "0.1.0-pre.2" dependencies = [ "env_logger 0.11.7", "libc", - "limbo_core", "tempfile", "tracing", "tracing-appender", "tracing-subscriber", + "turso_core", ] [[package]] @@ -2679,9 +2620,9 @@ name = "py-turso" version = "0.1.0-pre.2" dependencies = [ "anyhow", - "limbo_core", "pyo3", "pyo3-build-config", + "turso_core", "version_check", ] @@ -3792,7 +3733,6 @@ dependencies = [ "dirs 5.0.1", "env_logger 0.10.2", "libc", - "limbo_core", "miette", "nu-ansi-term 0.50.1", "rustyline", @@ -3805,17 +3745,77 @@ dependencies = [ "tracing", "tracing-appender", "tracing-subscriber", + "turso_core", "validator", ] +[[package]] +name = "turso_core" +version = "0.1.0-pre.2" +dependencies = [ + "bitflags 2.9.0", + "built", + "cfg_block", + "chrono", + "criterion", + "crossbeam-skiplist", + "env_logger 0.11.7", + "fallible-iterator", + "getrandom 0.2.15", + "hex", + "io-uring", + "julian_day_converter", + "libc", + "libloading", + "libm", + "limbo_completion", + "limbo_crypto", + "limbo_csv", + "limbo_ext", + "limbo_ipaddr", + "limbo_macros", + "limbo_percentile", + "limbo_regexp", + "limbo_series", + "limbo_sqlite3_parser", + "limbo_time", + "limbo_uuid", + "lru", + "miette", + "mimalloc", + "parking_lot", + "paste", + "polling", + "pprof", + "quickcheck", + "quickcheck_macros", + "rand 0.8.5", + "rand_chacha 0.9.0", + "regex", + "regex-syntax 0.8.5", + "rstest", + "rusqlite", + "rustix 1.0.7", + "ryu", + "serde", + "sorted-vec", + "strum", + "strum_macros", + "tempfile", + "test-log", + "thiserror 1.0.69", + "tracing", + "uncased", +] + [[package]] name = "turso_node" version = "0.1.0-pre.2" dependencies = [ - "limbo_core", "napi", "napi-build", "napi-derive", + "turso_core", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 5e835ccfe..e4d8b2707 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ repository = "https://github.com/tursodatabase/limbo" [workspace.dependencies] limbo_completion = { path = "extensions/completion", version = "0.1.0-pre.2" } -limbo_core = { path = "core", version = "0.1.0-pre.2" } +turso_core = { path = "core", version = "0.1.0-pre.2" } limbo_crypto = { path = "extensions/crypto", version = "0.1.0-pre.2" } limbo_csv = { path = "extensions/csv", version = "0.1.0-pre.2" } limbo_ext = { path = "extensions/core", version = "0.1.0-pre.2" } diff --git a/bindings/go/Cargo.toml b/bindings/go/Cargo.toml index 0a35db840..228aead5e 100644 --- a/bindings/go/Cargo.toml +++ b/bindings/go/Cargo.toml @@ -14,11 +14,11 @@ path = "rs_src/lib.rs" [features] default = ["io_uring"] -io_uring = ["limbo_core/io_uring"] +io_uring = ["turso_core/io_uring"] [dependencies] -limbo_core = { workspace = true } +turso_core = { workspace = true } [target.'cfg(target_os = "linux")'.dependencies] -limbo_core = { workspace = true, features = ["io_uring"] } +turso_core = { workspace = true, features = ["io_uring"] } diff --git a/bindings/go/rs_src/lib.rs b/bindings/go/rs_src/lib.rs index f37911f29..035a3ac40 100644 --- a/bindings/go/rs_src/lib.rs +++ b/bindings/go/rs_src/lib.rs @@ -2,11 +2,11 @@ mod rows; #[allow(dead_code)] mod statement; mod types; -use limbo_core::{Connection, Database, LimboError, IO}; use std::{ ffi::{c_char, c_void}, sync::Arc, }; +use turso_core::{Connection, Database, LimboError, IO}; /// # Safety /// Safe to be called from Go with null terminated DSN string. @@ -21,8 +21,8 @@ pub unsafe extern "C" fn db_open(path: *const c_char) -> *mut c_void { let path = unsafe { std::ffi::CStr::from_ptr(path) }; let path = path.to_str().unwrap(); let io: Arc = match path { - p if p.contains(":memory:") => Arc::new(limbo_core::MemoryIO::new()), - _ => Arc::new(limbo_core::PlatformIO::new().expect("Failed to create IO")), + p if p.contains(":memory:") => Arc::new(turso_core::MemoryIO::new()), + _ => Arc::new(turso_core::PlatformIO::new().expect("Failed to create IO")), }; let db = Database::open_file(io.clone(), path, false, false); match db { @@ -40,12 +40,12 @@ pub unsafe extern "C" fn db_open(path: *const c_char) -> *mut c_void { #[allow(dead_code)] struct LimboConn { conn: Arc, - io: Arc, + io: Arc, err: Option, } impl LimboConn { - fn new(conn: Arc, io: Arc) -> Self { + fn new(conn: Arc, io: Arc) -> Self { LimboConn { conn, io, diff --git a/bindings/go/rs_src/rows.rs b/bindings/go/rs_src/rows.rs index 8ec36666e..0e7e1bfbc 100644 --- a/bindings/go/rs_src/rows.rs +++ b/bindings/go/rs_src/rows.rs @@ -2,8 +2,8 @@ use crate::{ types::{LimboValue, ResultCode}, LimboConn, }; -use limbo_core::{LimboError, Statement, StepResult, Value}; use std::ffi::{c_char, c_void}; +use turso_core::{LimboError, Statement, StepResult, Value}; pub struct LimboRows<'conn> { stmt: Box, diff --git a/bindings/go/rs_src/statement.rs b/bindings/go/rs_src/statement.rs index d068f01c6..970ecd7cf 100644 --- a/bindings/go/rs_src/statement.rs +++ b/bindings/go/rs_src/statement.rs @@ -1,9 +1,9 @@ use crate::rows::LimboRows; use crate::types::{AllocPool, LimboValue, ResultCode}; use crate::LimboConn; -use limbo_core::{LimboError, Statement, StepResult}; use std::ffi::{c_char, c_void}; use std::num::NonZero; +use turso_core::{LimboError, Statement, StepResult}; #[no_mangle] pub extern "C" fn db_prepare(ctx: *mut c_void, query: *const c_char) -> *mut c_void { diff --git a/bindings/go/rs_src/types.rs b/bindings/go/rs_src/types.rs index 602777a00..134d6946d 100644 --- a/bindings/go/rs_src/types.rs +++ b/bindings/go/rs_src/types.rs @@ -174,62 +174,62 @@ impl LimboValue { Box::into_raw(Box::new(self)) as *const c_void } - pub fn from_owned_value(value: &limbo_core::Value) -> Self { + pub fn from_owned_value(value: &turso_core::Value) -> Self { match value { - limbo_core::Value::Integer(i) => { + turso_core::Value::Integer(i) => { LimboValue::new(ValueType::Integer, ValueUnion::from_int(*i)) } - limbo_core::Value::Float(r) => { + turso_core::Value::Float(r) => { LimboValue::new(ValueType::Real, ValueUnion::from_real(*r)) } - limbo_core::Value::Text(s) => { + turso_core::Value::Text(s) => { LimboValue::new(ValueType::Text, ValueUnion::from_str(s.as_str())) } - limbo_core::Value::Blob(b) => { + turso_core::Value::Blob(b) => { LimboValue::new(ValueType::Blob, ValueUnion::from_bytes(b.as_slice())) } - limbo_core::Value::Null => LimboValue::new(ValueType::Null, ValueUnion::from_null()), + turso_core::Value::Null => LimboValue::new(ValueType::Null, ValueUnion::from_null()), } } // The values we get from Go need to be temporarily owned by the statement until they are bound // then they can be cleaned up immediately afterwards - pub fn to_value(&self, pool: &mut AllocPool) -> limbo_core::Value { + pub fn to_value(&self, pool: &mut AllocPool) -> turso_core::Value { match self.value_type { ValueType::Integer => { if unsafe { self.value.int_val == 0 } { - return limbo_core::Value::Null; + return turso_core::Value::Null; } - limbo_core::Value::Integer(unsafe { self.value.int_val }) + turso_core::Value::Integer(unsafe { self.value.int_val }) } ValueType::Real => { if unsafe { self.value.real_val == 0.0 } { - return limbo_core::Value::Null; + return turso_core::Value::Null; } - limbo_core::Value::Float(unsafe { self.value.real_val }) + turso_core::Value::Float(unsafe { self.value.real_val }) } ValueType::Text => { if unsafe { self.value.text_ptr.is_null() } { - return limbo_core::Value::Null; + return turso_core::Value::Null; } let cstr = unsafe { std::ffi::CStr::from_ptr(self.value.text_ptr) }; match cstr.to_str() { Ok(utf8_str) => { let owned = utf8_str.to_owned(); let borrowed = pool.add_string(owned); - limbo_core::Value::build_text(borrowed) + turso_core::Value::build_text(borrowed) } - Err(_) => limbo_core::Value::Null, + Err(_) => turso_core::Value::Null, } } ValueType::Blob => { if unsafe { self.value.blob_ptr.is_null() } { - return limbo_core::Value::Null; + return turso_core::Value::Null; } let bytes = self.value.to_bytes(); - limbo_core::Value::Blob(bytes.to_vec()) + turso_core::Value::Blob(bytes.to_vec()) } - ValueType::Null => limbo_core::Value::Null, + ValueType::Null => turso_core::Value::Null, } } } diff --git a/bindings/java/Cargo.toml b/bindings/java/Cargo.toml index 1cbb3ff82..ee1fdc5f4 100644 --- a/bindings/java/Cargo.toml +++ b/bindings/java/Cargo.toml @@ -13,6 +13,6 @@ crate-type = ["cdylib"] path = "rs_src/lib.rs" [dependencies] -limbo_core = { path = "../../core", features = ["io_uring"] } +turso_core = { path = "../../core", features = ["io_uring"] } jni = "0.21.1" thiserror = "2.0.9" diff --git a/bindings/java/rs_src/errors.rs b/bindings/java/rs_src/errors.rs index b323a4385..0b92e46a7 100644 --- a/bindings/java/rs_src/errors.rs +++ b/bindings/java/rs_src/errors.rs @@ -16,8 +16,8 @@ pub enum LimboError { JNIErrors(Error), } -impl From for LimboError { - fn from(_value: limbo_core::LimboError) -> Self { +impl From for LimboError { + fn from(_value: turso_core::LimboError) -> Self { todo!() } } diff --git a/bindings/java/rs_src/limbo_connection.rs b/bindings/java/rs_src/limbo_connection.rs index 46431ed2b..354578ac3 100644 --- a/bindings/java/rs_src/limbo_connection.rs +++ b/bindings/java/rs_src/limbo_connection.rs @@ -7,17 +7,17 @@ use crate::utils::{set_err_msg_and_throw_exception, utf8_byte_arr_to_str}; use jni::objects::{JByteArray, JObject}; use jni::sys::jlong; use jni::JNIEnv; -use limbo_core::Connection; use std::sync::Arc; +use turso_core::Connection; #[derive(Clone)] pub struct LimboConnection { pub(crate) conn: Arc, - pub(crate) io: Arc, + pub(crate) io: Arc, } impl LimboConnection { - pub fn new(conn: Arc, io: Arc) -> Self { + pub fn new(conn: Arc, io: Arc) -> Self { LimboConnection { conn, io } } diff --git a/bindings/java/rs_src/limbo_db.rs b/bindings/java/rs_src/limbo_db.rs index 199408aaa..c7ecae787 100644 --- a/bindings/java/rs_src/limbo_db.rs +++ b/bindings/java/rs_src/limbo_db.rs @@ -4,16 +4,16 @@ use crate::utils::set_err_msg_and_throw_exception; use jni::objects::{JByteArray, JObject}; use jni::sys::{jint, jlong}; use jni::JNIEnv; -use limbo_core::Database; use std::sync::Arc; +use turso_core::Database; struct LimboDB { db: Arc, - io: Arc, + io: Arc, } impl LimboDB { - pub fn new(db: Arc, io: Arc) -> Self { + pub fn new(db: Arc, io: Arc) -> Self { LimboDB { db, io } } @@ -43,7 +43,7 @@ pub extern "system" fn Java_tech_turso_core_LimboDB_openUtf8<'local>( file_path_byte_arr: JByteArray<'local>, _open_flags: jint, ) -> jlong { - let io = match limbo_core::PlatformIO::new() { + let io = match turso_core::PlatformIO::new() { Ok(io) => Arc::new(io), Err(e) => { set_err_msg_and_throw_exception(&mut env, obj, LIMBO_ETC, e.to_string()); diff --git a/bindings/java/rs_src/limbo_statement.rs b/bindings/java/rs_src/limbo_statement.rs index 12f9e583d..72ff6cdbc 100644 --- a/bindings/java/rs_src/limbo_statement.rs +++ b/bindings/java/rs_src/limbo_statement.rs @@ -5,8 +5,8 @@ use crate::utils::set_err_msg_and_throw_exception; use jni::objects::{JByteArray, JObject, JObjectArray, JString, JValue}; use jni::sys::{jdouble, jint, jlong}; use jni::JNIEnv; -use limbo_core::{Statement, StepResult, Value}; use std::num::NonZero; +use turso_core::{Statement, StepResult, Value}; pub const STEP_RESULT_ID_ROW: i32 = 10; #[allow(dead_code)] @@ -101,21 +101,21 @@ pub extern "system" fn Java_tech_turso_core_LimboStatement__1close<'local>( fn row_to_obj_array<'local>( env: &mut JNIEnv<'local>, - row: &limbo_core::Row, + row: &turso_core::Row, ) -> Result> { let obj_array = env.new_object_array(row.len() as i32, "java/lang/Object", JObject::null())?; for (i, value) in row.get_values().enumerate() { let obj = match value { - limbo_core::Value::Null => JObject::null(), - limbo_core::Value::Integer(i) => { + turso_core::Value::Null => JObject::null(), + turso_core::Value::Integer(i) => { env.new_object("java/lang/Long", "(J)V", &[JValue::Long(*i)])? } - limbo_core::Value::Float(f) => { + turso_core::Value::Float(f) => { env.new_object("java/lang/Double", "(D)V", &[JValue::Double(*f)])? } - limbo_core::Value::Text(s) => env.new_string(s.as_str())?.into(), - limbo_core::Value::Blob(b) => env.byte_array_from_slice(b.as_slice())?.into(), + turso_core::Value::Text(s) => env.new_string(s.as_str())?.into(), + turso_core::Value::Blob(b) => env.byte_array_from_slice(b.as_slice())?.into(), }; if let Err(e) = env.set_object_array_element(&obj_array, i as i32, obj) { eprintln!("Error on parsing row: {:?}", e); diff --git a/bindings/javascript/Cargo.toml b/bindings/javascript/Cargo.toml index ab0c13eff..f02a8abe9 100644 --- a/bindings/javascript/Cargo.toml +++ b/bindings/javascript/Cargo.toml @@ -11,7 +11,7 @@ description = "The Turso database library Node bindings" crate-type = ["cdylib"] [dependencies] -limbo_core = { workspace = true } +turso_core = { workspace = true } napi = { version = "2.16.17", default-features = false, features = ["napi4"] } napi-derive = { version = "2.16.13", default-features = false } diff --git a/bindings/javascript/src/lib.rs b/bindings/javascript/src/lib.rs index 0433d8d09..c55296e0f 100644 --- a/bindings/javascript/src/lib.rs +++ b/bindings/javascript/src/lib.rs @@ -6,10 +6,10 @@ use std::num::NonZeroUsize; use std::rc::Rc; use std::sync::Arc; -use limbo_core::{LimboError, StepResult}; use napi::iterator::Generator; use napi::{bindgen_prelude::ObjectFinalize, Env, JsUnknown}; use napi_derive::napi; +use turso_core::{LimboError, StepResult}; #[derive(Default)] #[napi(object)] @@ -39,9 +39,9 @@ pub struct Database { // pub open: bool, #[napi(writable = false)] pub name: String, - _db: Arc, - conn: Arc, - io: Arc, + _db: Arc, + conn: Arc, + io: Arc, } impl ObjectFinalize for Database { @@ -57,21 +57,21 @@ impl Database { #[napi(constructor)] pub fn new(path: String, options: Option) -> napi::Result { let memory = path == ":memory:"; - let io: Arc = if memory { - Arc::new(limbo_core::MemoryIO::new()) + let io: Arc = if memory { + Arc::new(turso_core::MemoryIO::new()) } else { - Arc::new(limbo_core::PlatformIO::new().map_err(into_napi_error)?) + Arc::new(turso_core::PlatformIO::new().map_err(into_napi_error)?) }; let opts = options.unwrap_or_default(); let flag = if opts.readonly { - limbo_core::OpenFlags::ReadOnly + turso_core::OpenFlags::ReadOnly } else { - limbo_core::OpenFlags::Create + turso_core::OpenFlags::Create }; let file = io.open_file(&path, flag, false).map_err(into_napi_error)?; let db_file = Arc::new(DatabaseFile::new(file)); - let db = limbo_core::Database::open(io.clone(), &path, db_file, false, false) + let db = turso_core::Database::open(io.clone(), &path, db_file, false, false) .map_err(into_napi_error)?; let conn = db.connect().map_err(into_napi_error)?; @@ -105,19 +105,19 @@ impl Database { let mut stmt = stmt.inner.borrow_mut(); loop { match stmt.step().map_err(into_napi_error)? { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { let row: Vec<_> = stmt.row().unwrap().get_values().cloned().collect(); return to_js_value(&env, &row[0]); } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { return Ok(env.get_undefined()?.into_unknown()) } - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { self.io.run_once().map_err(into_napi_error)?; continue; } - step @ limbo_core::StepResult::Interrupt - | step @ limbo_core::StepResult::Busy => { + step @ turso_core::StepResult::Interrupt + | step @ turso_core::StepResult::Busy => { return Err(napi::Error::new( napi::Status::GenericFailure, format!("{:?}", step), @@ -162,7 +162,7 @@ impl Database { #[napi] pub fn load_extension(&self, path: String) -> napi::Result<()> { - let ext_path = limbo_core::resolve_ext_path(path.as_str()).map_err(into_napi_error)?; + let ext_path = turso_core::resolve_ext_path(path.as_str()).map_err(into_napi_error)?; self.conn .load_extension(ext_path) .map_err(into_napi_error)?; @@ -237,12 +237,12 @@ pub struct Statement { database: Database, presentation_mode: PresentationMode, binded: bool, - inner: Rc>, + inner: Rc>, } #[napi] impl Statement { - pub fn new(inner: RefCell, database: Database, source: String) -> Self { + pub fn new(inner: RefCell, database: Database, source: String) -> Self { Self { inner: Rc::new(inner), database, @@ -259,7 +259,7 @@ impl Statement { loop { let step = stmt.step().map_err(into_napi_error)?; match step { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { let row = stmt.row().unwrap(); match self.presentation_mode { @@ -297,12 +297,12 @@ impl Statement { } } } - limbo_core::StepResult::Done => return Ok(env.get_undefined()?.into_unknown()), - limbo_core::StepResult::IO => { + turso_core::StepResult::Done => return Ok(env.get_undefined()?.into_unknown()), + turso_core::StepResult::IO => { self.database.io.run_once().map_err(into_napi_error)?; continue; } - limbo_core::StepResult::Interrupt | limbo_core::StepResult::Busy => { + turso_core::StepResult::Interrupt | turso_core::StepResult::Busy => { return Err(napi::Error::new( napi::Status::GenericFailure, format!("{:?}", step), @@ -345,13 +345,13 @@ impl Statement { fn internal_all( &self, env: Env, - mut stmt: RefMut<'_, limbo_core::Statement>, + mut stmt: RefMut<'_, turso_core::Statement>, ) -> napi::Result { let mut results = env.create_empty_array()?; let mut index = 0; loop { match stmt.step().map_err(into_napi_error)? { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { let row = stmt.row().unwrap(); match self.presentation_mode { @@ -388,13 +388,13 @@ impl Statement { } } } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { break; } - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { self.database.io.run_once().map_err(into_napi_error)?; } - limbo_core::StepResult::Interrupt | limbo_core::StepResult::Busy => { + turso_core::StepResult::Interrupt | turso_core::StepResult::Busy => { return Err(napi::Error::new( napi::Status::GenericFailure, format!("{:?}", stmt.step()), @@ -447,7 +447,7 @@ impl Statement { fn check_and_bind( &self, args: Option>, - ) -> napi::Result> { + ) -> napi::Result> { let mut stmt = self.inner.borrow_mut(); stmt.reset(); if let Some(args) = args { @@ -470,7 +470,7 @@ impl Statement { #[napi(iterator)] pub struct IteratorStatement { - stmt: Rc>, + stmt: Rc>, database: Database, env: Env, presentation_mode: PresentationMode, @@ -488,7 +488,7 @@ impl Generator for IteratorStatement { loop { match stmt.step().ok()? { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { let row = stmt.row().unwrap(); match self.presentation_mode { @@ -517,47 +517,47 @@ impl Generator for IteratorStatement { } } } - limbo_core::StepResult::Done => return None, - limbo_core::StepResult::IO => { + turso_core::StepResult::Done => return None, + turso_core::StepResult::IO => { self.database.io.run_once().ok()?; continue; } - limbo_core::StepResult::Interrupt | limbo_core::StepResult::Busy => return None, + turso_core::StepResult::Interrupt | turso_core::StepResult::Busy => return None, } } } } -fn to_js_value(env: &napi::Env, value: &limbo_core::Value) -> napi::Result { +fn to_js_value(env: &napi::Env, value: &turso_core::Value) -> napi::Result { match value { - limbo_core::Value::Null => Ok(env.get_null()?.into_unknown()), - limbo_core::Value::Integer(i) => Ok(env.create_int64(*i)?.into_unknown()), - limbo_core::Value::Float(f) => Ok(env.create_double(*f)?.into_unknown()), - limbo_core::Value::Text(s) => Ok(env.create_string(s.as_str())?.into_unknown()), - limbo_core::Value::Blob(b) => Ok(env.create_buffer_copy(b.as_slice())?.into_unknown()), + turso_core::Value::Null => Ok(env.get_null()?.into_unknown()), + turso_core::Value::Integer(i) => Ok(env.create_int64(*i)?.into_unknown()), + turso_core::Value::Float(f) => Ok(env.create_double(*f)?.into_unknown()), + turso_core::Value::Text(s) => Ok(env.create_string(s.as_str())?.into_unknown()), + turso_core::Value::Blob(b) => Ok(env.create_buffer_copy(b.as_slice())?.into_unknown()), } } -fn from_js_value(value: JsUnknown) -> napi::Result { +fn from_js_value(value: JsUnknown) -> napi::Result { match value.get_type()? { napi::ValueType::Undefined | napi::ValueType::Null | napi::ValueType::Unknown => { - Ok(limbo_core::Value::Null) + Ok(turso_core::Value::Null) } napi::ValueType::Boolean => { let b = value.coerce_to_bool()?.get_value()?; - Ok(limbo_core::Value::Integer(b as i64)) + Ok(turso_core::Value::Integer(b as i64)) } napi::ValueType::Number => { let num = value.coerce_to_number()?.get_double()?; if num.fract() == 0.0 { - Ok(limbo_core::Value::Integer(num as i64)) + Ok(turso_core::Value::Integer(num as i64)) } else { - Ok(limbo_core::Value::Float(num)) + Ok(turso_core::Value::Float(num)) } } napi::ValueType::String => { let s = value.coerce_to_string()?; - Ok(limbo_core::Value::Text(s.into_utf8()?.as_str()?.into())) + Ok(turso_core::Value::Text(s.into_utf8()?.as_str()?.into())) } napi::ValueType::Symbol | napi::ValueType::Object @@ -570,28 +570,28 @@ fn from_js_value(value: JsUnknown) -> napi::Result { } struct DatabaseFile { - file: Arc, + file: Arc, } unsafe impl Send for DatabaseFile {} unsafe impl Sync for DatabaseFile {} impl DatabaseFile { - pub fn new(file: Arc) -> Self { + pub fn new(file: Arc) -> Self { Self { file } } } -impl limbo_core::DatabaseStorage for DatabaseFile { - fn read_page(&self, page_idx: usize, c: limbo_core::Completion) -> limbo_core::Result<()> { +impl turso_core::DatabaseStorage for DatabaseFile { + fn read_page(&self, page_idx: usize, c: turso_core::Completion) -> turso_core::Result<()> { let r = match c.completion_type { - limbo_core::CompletionType::Read(ref r) => r, + turso_core::CompletionType::Read(ref r) => r, _ => unreachable!(), }; let size = r.buf().len(); assert!(page_idx > 0); if !(512..=65536).contains(&size) || size & (size - 1) != 0 { - return Err(limbo_core::LimboError::NotADB); + return Err(turso_core::LimboError::NotADB); } let pos = (page_idx - 1) * size; self.file.pread(pos, c)?; @@ -601,21 +601,21 @@ impl limbo_core::DatabaseStorage for DatabaseFile { fn write_page( &self, page_idx: usize, - buffer: Arc>, - c: limbo_core::Completion, - ) -> limbo_core::Result<()> { + buffer: Arc>, + c: turso_core::Completion, + ) -> turso_core::Result<()> { let size = buffer.borrow().len(); let pos = (page_idx - 1) * size; self.file.pwrite(pos, buffer, c)?; Ok(()) } - fn sync(&self, c: limbo_core::Completion) -> limbo_core::Result<()> { + fn sync(&self, c: turso_core::Completion) -> turso_core::Result<()> { let _ = self.file.sync(c)?; Ok(()) } - fn size(&self) -> limbo_core::Result { + fn size(&self) -> turso_core::Result { self.file.size() } } diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index 4670aa9d4..46023b643 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -17,7 +17,7 @@ extension-module = ["pyo3/extension-module"] [dependencies] anyhow = "1.0" -limbo_core = { path = "../../core", features = ["io_uring"] } +turso_core = { path = "../../core", features = ["io_uring"] } pyo3 = { version = "0.24.1", features = ["anyhow"] } [build-dependencies] diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index 08c5201d3..84d94030d 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -1,12 +1,12 @@ use anyhow::Result; use errors::*; -use limbo_core::Value; use pyo3::prelude::*; use pyo3::types::{PyBytes, PyList, PyTuple}; use std::cell::RefCell; use std::num::NonZeroUsize; use std::rc::Rc; use std::sync::Arc; +use turso_core::Value; mod errors; @@ -61,7 +61,7 @@ pub struct Cursor { #[pyo3(get)] rowcount: i64, - smt: Option>>, + smt: Option>>, } #[allow(unused_variables, clippy::arc_with_non_send_sync)] @@ -95,7 +95,7 @@ impl Cursor { // For DDL and DML statements, // we need to execute the statement immediately if stmt_is_ddl || stmt_is_dml { - while let limbo_core::StepResult::IO = stmt + while let turso_core::StepResult::IO = stmt .borrow_mut() .step() .map_err(|e| PyErr::new::(format!("Step error: {:?}", e)))? @@ -125,23 +125,23 @@ impl Cursor { match stmt.step().map_err(|e| { PyErr::new::(format!("Step error: {:?}", e)) })? { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { let row = stmt.row().unwrap(); let py_row = row_to_py(py, row)?; return Ok(Some(py_row)); } - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { self.conn.io.run_once().map_err(|e| { PyErr::new::(format!("IO error: {:?}", e)) })?; } - limbo_core::StepResult::Interrupt => { + turso_core::StepResult::Interrupt => { return Ok(None); } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { return Ok(None); } - limbo_core::StepResult::Busy => { + turso_core::StepResult::Busy => { return Err( PyErr::new::("Busy error".to_string()).into() ); @@ -161,23 +161,23 @@ impl Cursor { match stmt.step().map_err(|e| { PyErr::new::(format!("Step error: {:?}", e)) })? { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { let row = stmt.row().unwrap(); let py_row = row_to_py(py, row)?; results.push(py_row); } - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { self.conn.io.run_once().map_err(|e| { PyErr::new::(format!("IO error: {:?}", e)) })?; } - limbo_core::StepResult::Interrupt => { + turso_core::StepResult::Interrupt => { return Ok(results); } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { return Ok(results); } - limbo_core::StepResult::Busy => { + turso_core::StepResult::Busy => { return Err( PyErr::new::("Busy error".to_string()).into() ); @@ -225,8 +225,8 @@ fn stmt_is_ddl(sql: &str) -> bool { #[pyclass(unsendable)] #[derive(Clone)] pub struct Connection { - conn: Arc, - io: Arc, + conn: Arc, + io: Arc, } #[pymethods] @@ -302,39 +302,39 @@ impl Drop for Connection { pub fn connect(path: &str) -> Result { #[inline(always)] fn open_or( - io: Arc, + io: Arc, path: &str, - ) -> std::result::Result, PyErr> { - limbo_core::Database::open_file(io, path, false, false).map_err(|e| { + ) -> std::result::Result, PyErr> { + turso_core::Database::open_file(io, path, false, false).map_err(|e| { PyErr::new::(format!("Failed to open database: {:?}", e)) }) } match path { ":memory:" => { - let io: Arc = Arc::new(limbo_core::MemoryIO::new()); + let io: Arc = Arc::new(turso_core::MemoryIO::new()); let db = open_or(io.clone(), path)?; - let conn: Arc = db.connect().unwrap(); + let conn: Arc = db.connect().unwrap(); Ok(Connection { conn, io }) } path => { - let io: Arc = Arc::new(limbo_core::PlatformIO::new()?); + let io: Arc = Arc::new(turso_core::PlatformIO::new()?); let db = open_or(io.clone(), path)?; - let conn: Arc = db.connect().unwrap(); + let conn: Arc = db.connect().unwrap(); Ok(Connection { conn, io }) } } } -fn row_to_py(py: Python, row: &limbo_core::Row) -> Result { +fn row_to_py(py: Python, row: &turso_core::Row) -> Result { let mut py_values = Vec::new(); for value in row.get_values() { match value { - limbo_core::Value::Null => py_values.push(py.None()), - limbo_core::Value::Integer(i) => py_values.push(i.into_pyobject(py)?.into()), - limbo_core::Value::Float(f) => py_values.push(f.into_pyobject(py)?.into()), - limbo_core::Value::Text(s) => py_values.push(s.as_str().into_pyobject(py)?.into()), - limbo_core::Value::Blob(b) => py_values.push(PyBytes::new(py, b.as_slice()).into()), + turso_core::Value::Null => py_values.push(py.None()), + turso_core::Value::Integer(i) => py_values.push(i.into_pyobject(py)?.into()), + turso_core::Value::Float(f) => py_values.push(f.into_pyobject(py)?.into()), + turso_core::Value::Text(s) => py_values.push(s.as_str().into_pyobject(py)?.into()), + turso_core::Value::Blob(b) => py_values.push(PyBytes::new(py, b.as_slice()).into()), } } Ok(PyTuple::new(py, &py_values) @@ -344,7 +344,7 @@ fn row_to_py(py: Python, row: &limbo_core::Row) -> Result { } /// Converts a Python object to a Limbo Value -fn py_to_owned_value(obj: &Bound) -> Result { +fn py_to_owned_value(obj: &Bound) -> Result { if obj.is_none() { Ok(Value::Null) } else if let Ok(integer) = obj.extract::() { diff --git a/bindings/rust/Cargo.toml b/bindings/rust/Cargo.toml index 7a4d613e9..e29016c24 100644 --- a/bindings/rust/Cargo.toml +++ b/bindings/rust/Cargo.toml @@ -10,7 +10,7 @@ repository.workspace = true description = "Limbo Rust API" [dependencies] -limbo_core = { workspace = true, features = ["io_uring"] } +turso_core = { workspace = true, features = ["io_uring"] } thiserror = "2.0.9" [dev-dependencies] diff --git a/bindings/rust/src/lib.rs b/bindings/rust/src/lib.rs index 7fc83cdff..c7a82b592 100644 --- a/bindings/rust/src/lib.rs +++ b/bindings/rust/src/lib.rs @@ -54,8 +54,8 @@ pub enum Error { SqlExecutionFailure(String), } -impl From for Error { - fn from(err: limbo_core::LimboError) -> Self { +impl From for Error { + fn from(err: turso_core::LimboError) -> Self { Error::SqlExecutionFailure(err.to_string()) } } @@ -82,13 +82,13 @@ impl Builder { pub async fn build(self) -> Result { match self.path.as_str() { ":memory:" => { - let io: Arc = Arc::new(limbo_core::MemoryIO::new()); - let db = limbo_core::Database::open_file(io, self.path.as_str(), false, false)?; + let io: Arc = Arc::new(turso_core::MemoryIO::new()); + let db = turso_core::Database::open_file(io, self.path.as_str(), false, false)?; Ok(Database { inner: db }) } path => { - let io: Arc = Arc::new(limbo_core::PlatformIO::new()?); - let db = limbo_core::Database::open_file(io, path, false, false)?; + let io: Arc = Arc::new(turso_core::PlatformIO::new()?); + let db = turso_core::Database::open_file(io, path, false, false)?; Ok(Database { inner: db }) } } @@ -100,7 +100,7 @@ impl Builder { /// The `Database` object points to a database and allows you to connect to it #[derive(Clone)] pub struct Database { - inner: Arc, + inner: Arc, } unsafe impl Send for Database {} @@ -126,7 +126,7 @@ impl Database { /// A database connection. pub struct Connection { - inner: Arc>>, + inner: Arc>>, } impl Clone for Connection { @@ -172,7 +172,7 @@ impl Connection { /// Query a pragma. pub fn pragma_query(&self, pragma_name: &str, mut f: F) -> Result<()> where - F: FnMut(&Row) -> limbo_core::Result<()>, + F: FnMut(&Row) -> turso_core::Result<()>, { let conn = self .inner @@ -203,7 +203,7 @@ impl Debug for Connection { /// A prepared statement. pub struct Statement { - inner: Arc>, + inner: Arc>, } impl Clone for Statement { @@ -270,21 +270,21 @@ impl Statement { loop { let mut stmt = self.inner.lock().unwrap(); match stmt.step() { - Ok(limbo_core::StepResult::Row) => { + Ok(turso_core::StepResult::Row) => { // unexpected row during execution, error out. return Ok(2); } - Ok(limbo_core::StepResult::Done) => { + Ok(turso_core::StepResult::Done) => { return Ok(0); } - Ok(limbo_core::StepResult::IO) => { + Ok(turso_core::StepResult::IO) => { let _ = stmt.run_once(); //return Ok(1); } - Ok(limbo_core::StepResult::Busy) => { + Ok(turso_core::StepResult::Busy) => { return Ok(4); } - Ok(limbo_core::StepResult::Interrupt) => { + Ok(turso_core::StepResult::Interrupt) => { return Ok(3); } Err(err) => { @@ -347,7 +347,7 @@ pub struct Transaction {} /// Results of a prepared statement query. pub struct Rows { - inner: Arc>, + inner: Arc>, } impl Clone for Rows { @@ -370,21 +370,21 @@ impl Rows { .lock() .map_err(|e| Error::MutexError(e.to_string()))?; match stmt.step() { - Ok(limbo_core::StepResult::Row) => { + Ok(turso_core::StepResult::Row) => { let row = stmt.row().unwrap(); return Ok(Some(Row { values: row.get_values().map(|v| v.to_owned()).collect(), })); } - Ok(limbo_core::StepResult::Done) => return Ok(None), - Ok(limbo_core::StepResult::IO) => { + Ok(turso_core::StepResult::Done) => return Ok(None), + Ok(turso_core::StepResult::IO) => { if let Err(e) = stmt.run_once() { return Err(e.into()); } continue; } - Ok(limbo_core::StepResult::Busy) => return Ok(None), - Ok(limbo_core::StepResult::Interrupt) => return Ok(None), + Ok(turso_core::StepResult::Busy) => return Ok(None), + Ok(turso_core::StepResult::Interrupt) => return Ok(None), _ => return Ok(None), } } @@ -394,7 +394,7 @@ impl Rows { /// Query result row. #[derive(Debug)] pub struct Row { - values: Vec, + values: Vec, } unsafe impl Send for Row {} @@ -404,11 +404,11 @@ impl Row { pub fn get_value(&self, index: usize) -> Result { let value = &self.values[index]; match value { - limbo_core::Value::Integer(i) => Ok(Value::Integer(*i)), - limbo_core::Value::Null => Ok(Value::Null), - limbo_core::Value::Float(f) => Ok(Value::Real(*f)), - limbo_core::Value::Text(text) => Ok(Value::Text(text.to_string())), - limbo_core::Value::Blob(items) => Ok(Value::Blob(items.to_vec())), + turso_core::Value::Integer(i) => Ok(Value::Integer(*i)), + turso_core::Value::Null => Ok(Value::Null), + turso_core::Value::Float(f) => Ok(Value::Real(*f)), + turso_core::Value::Text(text) => Ok(Value::Text(text.to_string())), + turso_core::Value::Blob(items) => Ok(Value::Blob(items.to_vec())), } } @@ -417,16 +417,16 @@ impl Row { } } -impl<'a> FromIterator<&'a limbo_core::Value> for Row { - fn from_iter>(iter: T) -> Self { +impl<'a> FromIterator<&'a turso_core::Value> for Row { + fn from_iter>(iter: T) -> Self { let values = iter .into_iter() .map(|v| match v { - limbo_core::Value::Integer(i) => limbo_core::Value::Integer(*i), - limbo_core::Value::Null => limbo_core::Value::Null, - limbo_core::Value::Float(f) => limbo_core::Value::Float(*f), - limbo_core::Value::Text(s) => limbo_core::Value::Text(s.clone()), - limbo_core::Value::Blob(b) => limbo_core::Value::Blob(b.clone()), + turso_core::Value::Integer(i) => turso_core::Value::Integer(*i), + turso_core::Value::Null => turso_core::Value::Null, + turso_core::Value::Float(f) => turso_core::Value::Float(*f), + turso_core::Value::Text(s) => turso_core::Value::Text(s.clone()), + turso_core::Value::Blob(b) => turso_core::Value::Blob(b.clone()), }) .collect(); diff --git a/bindings/rust/src/value.rs b/bindings/rust/src/value.rs index 64dc31ce8..567476513 100644 --- a/bindings/rust/src/value.rs +++ b/bindings/rust/src/value.rs @@ -110,14 +110,14 @@ impl Value { } } -impl From for limbo_core::Value { +impl From for turso_core::Value { fn from(val: Value) -> Self { match val { - Value::Null => limbo_core::Value::Null, - Value::Integer(n) => limbo_core::Value::Integer(n), - Value::Real(n) => limbo_core::Value::Float(n), - Value::Text(t) => limbo_core::Value::from_text(&t), - Value::Blob(items) => limbo_core::Value::from_blob(items), + Value::Null => turso_core::Value::Null, + Value::Integer(n) => turso_core::Value::Integer(n), + Value::Real(n) => turso_core::Value::Float(n), + Value::Text(t) => turso_core::Value::from_text(&t), + Value::Blob(items) => turso_core::Value::from_blob(items), } } } diff --git a/bindings/wasm/Cargo.toml b/bindings/wasm/Cargo.toml index 2fdcf3f3c..906ebaab4 100644 --- a/bindings/wasm/Cargo.toml +++ b/bindings/wasm/Cargo.toml @@ -13,7 +13,7 @@ path = "lib.rs" [dependencies] console_error_panic_hook = "0.1.7" js-sys = "0.3.72" -limbo_core = { path = "../../core", default-features = false } +turso_core = { path = "../../core", default-features = false } wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" web-sys = "0.3" diff --git a/bindings/wasm/lib.rs b/bindings/wasm/lib.rs index db31aa8da..37f42de9e 100644 --- a/bindings/wasm/lib.rs +++ b/bindings/wasm/lib.rs @@ -2,16 +2,16 @@ compile_error!("Features 'web' and 'nodejs' cannot be enabled at the same time"); use js_sys::{Array, Object}; -use limbo_core::{Clock, Instant, OpenFlags, Result}; use std::cell::RefCell; use std::sync::Arc; +use turso_core::{Clock, Instant, OpenFlags, Result}; use wasm_bindgen::prelude::*; #[allow(dead_code)] #[wasm_bindgen] pub struct Database { - db: Arc, - conn: Arc, + db: Arc, + conn: Arc, } #[allow(clippy::arc_with_non_send_sync)] @@ -19,10 +19,10 @@ pub struct Database { impl Database { #[wasm_bindgen(constructor)] pub fn new(path: &str) -> Database { - let io: Arc = Arc::new(PlatformIO { vfs: VFS::new() }); + let io: Arc = Arc::new(PlatformIO { vfs: VFS::new() }); let file = io.open_file(path, OpenFlags::Create, false).unwrap(); let db_file = Arc::new(DatabaseFile::new(file)); - let db = limbo_core::Database::open(io, path, db_file, false, false).unwrap(); + let db = turso_core::Database::open(io, path, db_file, false, false).unwrap(); let conn = db.connect().unwrap(); Database { db, conn } } @@ -41,12 +41,12 @@ impl Database { #[wasm_bindgen] pub struct RowIterator { - inner: RefCell, + inner: RefCell, } #[wasm_bindgen] impl RowIterator { - fn new(inner: RefCell) -> Self { + fn new(inner: RefCell) -> Self { Self { inner } } @@ -55,7 +55,7 @@ impl RowIterator { pub fn next(&mut self) -> JsValue { let mut stmt = self.inner.borrow_mut(); match stmt.step() { - Ok(limbo_core::StepResult::Row) => { + Ok(turso_core::StepResult::Row) => { let row = stmt.row().unwrap(); let row_array = Array::new(); for value in row.get_values() { @@ -64,11 +64,11 @@ impl RowIterator { } JsValue::from(row_array) } - Ok(limbo_core::StepResult::IO) => JsValue::UNDEFINED, - Ok(limbo_core::StepResult::Done) | Ok(limbo_core::StepResult::Interrupt) => { + Ok(turso_core::StepResult::IO) => JsValue::UNDEFINED, + Ok(turso_core::StepResult::Done) | Ok(turso_core::StepResult::Interrupt) => { JsValue::UNDEFINED } - Ok(limbo_core::StepResult::Busy) => JsValue::UNDEFINED, + Ok(turso_core::StepResult::Busy) => JsValue::UNDEFINED, Err(e) => panic!("Error: {:?}", e), } } @@ -76,13 +76,13 @@ impl RowIterator { #[wasm_bindgen] pub struct Statement { - inner: RefCell, + inner: RefCell, raw: bool, } #[wasm_bindgen] impl Statement { - fn new(inner: RefCell, raw: bool) -> Self { + fn new(inner: RefCell, raw: bool) -> Self { Self { inner, raw } } @@ -95,7 +95,7 @@ impl Statement { pub fn get(&self) -> JsValue { let mut stmt = self.inner.borrow_mut(); match stmt.step() { - Ok(limbo_core::StepResult::Row) => { + Ok(turso_core::StepResult::Row) => { let row = stmt.row().unwrap(); let row_array = js_sys::Array::new(); for value in row.get_values() { @@ -104,10 +104,10 @@ impl Statement { } JsValue::from(row_array) } - Ok(limbo_core::StepResult::IO) - | Ok(limbo_core::StepResult::Done) - | Ok(limbo_core::StepResult::Interrupt) - | Ok(limbo_core::StepResult::Busy) => JsValue::UNDEFINED, + Ok(turso_core::StepResult::IO) + | Ok(turso_core::StepResult::Done) + | Ok(turso_core::StepResult::Interrupt) + | Ok(turso_core::StepResult::Busy) => JsValue::UNDEFINED, Err(e) => panic!("Error: {:?}", e), } } @@ -117,7 +117,7 @@ impl Statement { loop { let mut stmt = self.inner.borrow_mut(); match stmt.step() { - Ok(limbo_core::StepResult::Row) => { + Ok(turso_core::StepResult::Row) => { let row = stmt.row().unwrap(); let row_array = js_sys::Array::new(); for value in row.get_values() { @@ -126,10 +126,10 @@ impl Statement { } array.push(&row_array); } - Ok(limbo_core::StepResult::IO) => {} - Ok(limbo_core::StepResult::Interrupt) => break, - Ok(limbo_core::StepResult::Done) => break, - Ok(limbo_core::StepResult::Busy) => break, + Ok(turso_core::StepResult::IO) => {} + Ok(turso_core::StepResult::Interrupt) => break, + Ok(turso_core::StepResult::Done) => break, + Ok(turso_core::StepResult::Busy) => break, Err(e) => panic!("Error: {:?}", e), } } @@ -168,10 +168,10 @@ impl Statement { } } -fn to_js_value(value: &limbo_core::Value) -> JsValue { +fn to_js_value(value: &turso_core::Value) -> JsValue { match value { - limbo_core::Value::Null => JsValue::null(), - limbo_core::Value::Integer(i) => { + turso_core::Value::Null => JsValue::null(), + turso_core::Value::Integer(i) => { let i = *i; if i >= i32::MIN as i64 && i <= i32::MAX as i64 { JsValue::from(i as i32) @@ -179,9 +179,9 @@ fn to_js_value(value: &limbo_core::Value) -> JsValue { JsValue::from(i) } } - limbo_core::Value::Float(f) => JsValue::from(*f), - limbo_core::Value::Text(t) => JsValue::from_str(t.as_str()), - limbo_core::Value::Blob(b) => js_sys::Uint8Array::from(b.as_slice()).into(), + turso_core::Value::Float(f) => JsValue::from(*f), + turso_core::Value::Text(t) => JsValue::from_str(t.as_str()), + turso_core::Value::Blob(b) => js_sys::Uint8Array::from(b.as_slice()).into(), } } @@ -200,7 +200,7 @@ impl File { } } -impl limbo_core::File for File { +impl turso_core::File for File { fn lock_file(&self, _exclusive: bool) -> Result<()> { // TODO Ok(()) @@ -211,9 +211,9 @@ impl limbo_core::File for File { Ok(()) } - fn pread(&self, pos: usize, c: limbo_core::Completion) -> Result> { + fn pread(&self, pos: usize, c: turso_core::Completion) -> Result> { let r = match c.completion_type { - limbo_core::CompletionType::Read(ref r) => r, + turso_core::CompletionType::Read(ref r) => r, _ => unreachable!(), }; { @@ -230,11 +230,11 @@ impl limbo_core::File for File { fn pwrite( &self, pos: usize, - buffer: Arc>, - c: limbo_core::Completion, - ) -> Result> { + buffer: Arc>, + c: turso_core::Completion, + ) -> Result> { let w = match c.completion_type { - limbo_core::CompletionType::Write(ref w) => w, + turso_core::CompletionType::Write(ref w) => w, _ => unreachable!(), }; let buf = buffer.borrow(); @@ -245,7 +245,7 @@ impl limbo_core::File for File { Ok(Arc::new(c)) } - fn sync(&self, c: limbo_core::Completion) -> Result> { + fn sync(&self, c: turso_core::Completion) -> Result> { self.vfs.sync(self.fd); c.complete(0); #[allow(clippy::arc_with_non_send_sync)] @@ -275,13 +275,13 @@ impl Clock for PlatformIO { } } -impl limbo_core::IO for PlatformIO { +impl turso_core::IO for PlatformIO { fn open_file( &self, path: &str, _flags: OpenFlags, _direct: bool, - ) -> Result> { + ) -> Result> { let fd = self.vfs.open(path, "a+"); Ok(Arc::new(File { vfs: VFS::new(), @@ -289,7 +289,7 @@ impl limbo_core::IO for PlatformIO { })) } - fn wait_for_completion(&self, c: Arc) -> Result<()> { + fn wait_for_completion(&self, c: Arc) -> Result<()> { while !c.is_completed() { self.run_once()?; } @@ -306,8 +306,8 @@ impl limbo_core::IO for PlatformIO { i64::from_ne_bytes(buf) } - fn get_memory_io(&self) -> Arc { - Arc::new(limbo_core::MemoryIO::new()) + fn get_memory_io(&self) -> Arc { + Arc::new(turso_core::MemoryIO::new()) } } @@ -326,28 +326,28 @@ extern "C" { } pub struct DatabaseFile { - file: Arc, + file: Arc, } unsafe impl Send for DatabaseFile {} unsafe impl Sync for DatabaseFile {} impl DatabaseFile { - pub fn new(file: Arc) -> Self { + pub fn new(file: Arc) -> Self { Self { file } } } -impl limbo_core::DatabaseStorage for DatabaseFile { - fn read_page(&self, page_idx: usize, c: limbo_core::Completion) -> Result<()> { +impl turso_core::DatabaseStorage for DatabaseFile { + fn read_page(&self, page_idx: usize, c: turso_core::Completion) -> Result<()> { let r = match c.completion_type { - limbo_core::CompletionType::Read(ref r) => r, + turso_core::CompletionType::Read(ref r) => r, _ => unreachable!(), }; let size = r.buf().len(); assert!(page_idx > 0); if !(512..=65536).contains(&size) || size & (size - 1) != 0 { - return Err(limbo_core::LimboError::NotADB); + return Err(turso_core::LimboError::NotADB); } let pos = (page_idx - 1) * size; self.file.pread(pos, c)?; @@ -357,8 +357,8 @@ impl limbo_core::DatabaseStorage for DatabaseFile { fn write_page( &self, page_idx: usize, - buffer: Arc>, - c: limbo_core::Completion, + buffer: Arc>, + c: turso_core::Completion, ) -> Result<()> { let size = buffer.borrow().len(); let pos = (page_idx - 1) * size; @@ -366,7 +366,7 @@ impl limbo_core::DatabaseStorage for DatabaseFile { Ok(()) } - fn sync(&self, c: limbo_core::Completion) -> Result<()> { + fn sync(&self, c: turso_core::Completion) -> Result<()> { let _ = self.file.sync(c)?; Ok(()) } diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 51181c83b..b4e233034 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -28,7 +28,7 @@ ctrlc = "3.4.4" dirs = "5.0.1" env_logger = "0.10.1" libc = "0.2.172" -limbo_core = { path = "../core", default-features = true, features = [ +turso_core = { path = "../core", default-features = true, features = [ "completion", ] } miette = { version = "7.4.0", features = ["fancy"] } @@ -49,7 +49,7 @@ toml_edit = {version = "0.22.24", features = ["serde"]} [features] default = ["io_uring"] -io_uring = ["limbo_core/io_uring"] +io_uring = ["turso_core/io_uring"] [build-dependencies] syntect = { git = "https://github.com/trishume/syntect.git", rev = "64644ffe064457265cbcee12a0c1baf9485ba6ee" } diff --git a/cli/app.rs b/cli/app.rs index 99478a0d8..361271bef 100644 --- a/cli/app.rs +++ b/cli/app.rs @@ -11,9 +11,9 @@ use crate::{ HISTORY_FILE, }; use comfy_table::{Attribute, Cell, CellAlignment, ContentArrangement, Row, Table}; -use limbo_core::{Database, LimboError, Statement, StepResult, Value}; use tracing_appender::non_blocking::WorkerGuard; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter}; +use turso_core::{Database, LimboError, Statement, StepResult, Value}; use clap::Parser; use rustyline::{error::ReadlineError, history::DefaultHistory, Editor}; @@ -67,9 +67,9 @@ const PROMPT: &str = "turso> "; pub struct Limbo { pub prompt: String, - io: Arc, + io: Arc, writer: Box, - conn: Arc, + conn: Arc, pub interrupt_count: Arc, input_buff: String, opts: Settings, @@ -222,7 +222,7 @@ impl Limbo { #[cfg(not(target_family = "wasm"))] fn handle_load_extension(&mut self, path: &str) -> Result<(), String> { - let ext_path = limbo_core::resolve_ext_path(path).map_err(|e| e.to_string())?; + let ext_path = turso_core::resolve_ext_path(path).map_err(|e| e.to_string())?; self.conn .load_extension(ext_path) .map_err(|e| e.to_string()) @@ -235,7 +235,7 @@ impl Limbo { query_internal!( self, query, - |row: &limbo_core::Row| -> Result<(), LimboError> { + |row: &turso_core::Row| -> Result<(), LimboError> { let name: &str = row.get::<&str>(1)?; cols.push(name.to_string()); let value_type: &str = row.get::<&str>(2)?; @@ -251,7 +251,7 @@ impl Limbo { query_internal!( self, select, - |row: &limbo_core::Row| -> Result<(), LimboError> { + |row: &turso_core::Row| -> Result<(), LimboError> { let values = row .get_values() .zip(value_types.iter()) @@ -302,7 +302,7 @@ impl Limbo { let res = query_internal!( self, query, - |row: &limbo_core::Row| -> Result<(), LimboError> { + |row: &turso_core::Row| -> Result<(), LimboError> { let sql: &str = row.get::<&str>(2)?; let name: &str = row.get::<&str>(0)?; self.write_fmt(format_args!("{};", sql))?; diff --git a/cli/commands/import.rs b/cli/commands/import.rs index 7450178d0..eee0b57d1 100644 --- a/cli/commands/import.rs +++ b/cli/commands/import.rs @@ -1,7 +1,7 @@ use clap::Args; use clap_complete::{ArgValueCompleter, PathCompleter}; -use limbo_core::Connection; use std::{fs::File, io::Write, path::PathBuf, sync::Arc}; +use turso_core::Connection; #[derive(Debug, Clone, Args)] pub struct ImportArgs { @@ -21,14 +21,14 @@ pub struct ImportArgs { pub struct ImportFile<'a> { conn: Arc, - io: Arc, + io: Arc, writer: &'a mut dyn Write, } impl<'a> ImportFile<'a> { pub fn new( conn: Arc, - io: Arc, + io: Arc, writer: &'a mut dyn Write, ) -> Self { Self { conn, io, writer } @@ -78,17 +78,17 @@ impl<'a> ImportFile<'a> { if let Some(mut rows) = rows { while let Ok(x) = rows.step() { match x { - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { self.io.run_once().unwrap(); } - limbo_core::StepResult::Done => break, - limbo_core::StepResult::Interrupt => break, - limbo_core::StepResult::Busy => { + turso_core::StepResult::Done => break, + turso_core::StepResult::Interrupt => break, + turso_core::StepResult::Busy => { let _ = self.writer.write_all("database is busy\n".as_bytes()); break; } - limbo_core::StepResult::Row => todo!(), + turso_core::StepResult::Row => todo!(), } } } diff --git a/cli/helper.rs b/cli/helper.rs index c11e5b535..6076e1d0f 100644 --- a/cli/helper.rs +++ b/cli/helper.rs @@ -1,5 +1,4 @@ use clap::Parser; -use limbo_core::{Connection, StepResult}; use nu_ansi_term::{Color, Style}; use rustyline::completion::{extract_word, Completer, Pair}; use rustyline::highlight::Highlighter; @@ -15,6 +14,7 @@ use syntect::easy::HighlightLines; use syntect::highlighting::ThemeSet; use syntect::parsing::{Scope, SyntaxSet}; use syntect::util::{as_24_bit_terminal_escaped, LinesWithEndings}; +use turso_core::{Connection, StepResult}; use crate::commands::CommandParser; use crate::config::{HighlightConfig, CONFIG_DIR}; @@ -42,7 +42,7 @@ pub struct LimboHelper { impl LimboHelper { pub fn new( conn: Arc, - io: Arc, + io: Arc, syntax_config: Option, ) -> Self { // Load only predefined syntax @@ -141,7 +141,7 @@ impl Highlighter for LimboHelper { pub struct SqlCompleter { conn: Arc, - io: Arc, + io: Arc, // Has to be a ref cell as Rustyline takes immutable reference to self // This problem would be solved with Reedline as it uses &mut self for completions cmd: RefCell, @@ -149,7 +149,7 @@ pub struct SqlCompleter { } impl SqlCompleter { - pub fn new(conn: Arc, io: Arc) -> Self { + pub fn new(conn: Arc, io: Arc) -> Self { Self { conn, io, diff --git a/cli/input.rs b/cli/input.rs index e20d5a71a..1ade1528f 100644 --- a/cli/input.rs +++ b/cli/input.rs @@ -145,28 +145,28 @@ pub fn get_writer(output: &str) -> Box { } } -pub fn get_io(db_location: DbLocation, io_choice: &str) -> anyhow::Result> { +pub fn get_io(db_location: DbLocation, io_choice: &str) -> anyhow::Result> { Ok(match db_location { - DbLocation::Memory => Arc::new(limbo_core::MemoryIO::new()), + DbLocation::Memory => Arc::new(turso_core::MemoryIO::new()), DbLocation::Path => { match io_choice { - "memory" => Arc::new(limbo_core::MemoryIO::new()), + "memory" => Arc::new(turso_core::MemoryIO::new()), "syscall" => { // We are building for Linux/macOS and syscall backend has been selected #[cfg(target_family = "unix")] { - Arc::new(limbo_core::UnixIO::new()?) + Arc::new(turso_core::UnixIO::new()?) } // We are not building for Linux/macOS and syscall backend has been selected #[cfg(not(target_family = "unix"))] { - Arc::new(limbo_core::PlatformIO::new()?) + Arc::new(turso_core::PlatformIO::new()?) } } // We are building for Linux and io_uring backend has been selected #[cfg(all(target_os = "linux", feature = "io_uring"))] - "io_uring" => Arc::new(limbo_core::UringIO::new()?), - _ => Arc::new(limbo_core::PlatformIO::new()?), + "io_uring" => Arc::new(turso_core::UringIO::new()?), + _ => Arc::new(turso_core::PlatformIO::new()?), } } }) diff --git a/core/Cargo.toml b/core/Cargo.toml index 2256366c9..3e9c51693 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,16 +1,16 @@ -# Copyright 2023 the Limbo authors. All rights reserved. MIT license. +# Copyright 2023-2025 the Turso authors. All rights reserved. MIT license. [package] -name = "limbo_core" +name = "turso_core" version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true repository.workspace = true -description = "The Limbo database library" +description = "The Turso database library" [lib] -name = "limbo_core" +name = "turso_core" path = "lib.rs" [features] diff --git a/core/benches/benchmark.rs b/core/benches/benchmark.rs index eefd7f99b..0193ff216 100644 --- a/core/benches/benchmark.rs +++ b/core/benches/benchmark.rs @@ -1,7 +1,7 @@ use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; -use limbo_core::{Database, PlatformIO, IO}; use pprof::criterion::{Output, PProfProfiler}; use std::sync::Arc; +use turso_core::{Database, PlatformIO, IO}; fn rusqlite_open() -> rusqlite::Connection { let sqlite_conn = rusqlite::Connection::open("../testing/testing.db").unwrap(); @@ -83,16 +83,16 @@ fn bench_execute_select_rows(criterion: &mut Criterion) { b.iter(|| { loop { match stmt.step().unwrap() { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { black_box(stmt.row()); } - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { let _ = io.run_once(); } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { break; } - limbo_core::StepResult::Interrupt | limbo_core::StepResult::Busy => { + turso_core::StepResult::Interrupt | turso_core::StepResult::Busy => { unreachable!(); } } @@ -145,16 +145,16 @@ fn bench_execute_select_1(criterion: &mut Criterion) { b.iter(|| { loop { match stmt.step().unwrap() { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { black_box(stmt.row()); } - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { let _ = io.run_once(); } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { break; } - limbo_core::StepResult::Interrupt | limbo_core::StepResult::Busy => { + turso_core::StepResult::Interrupt | turso_core::StepResult::Busy => { unreachable!(); } } @@ -198,16 +198,16 @@ fn bench_execute_select_count(criterion: &mut Criterion) { b.iter(|| { loop { match stmt.step().unwrap() { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { black_box(stmt.row()); } - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { let _ = io.run_once(); } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { break; } - limbo_core::StepResult::Interrupt | limbo_core::StepResult::Busy => { + turso_core::StepResult::Interrupt | turso_core::StepResult::Busy => { unreachable!(); } } diff --git a/core/benches/json_benchmark.rs b/core/benches/json_benchmark.rs index 493494738..3caa4e3bb 100644 --- a/core/benches/json_benchmark.rs +++ b/core/benches/json_benchmark.rs @@ -1,10 +1,10 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use limbo_core::{Database, PlatformIO, IO}; use pprof::{ criterion::{Output, PProfProfiler}, flamegraph::Options, }; use std::sync::Arc; +use turso_core::{Database, PlatformIO, IO}; // Title: JSONB Function Benchmarking @@ -451,14 +451,14 @@ fn bench(criterion: &mut Criterion) { b.iter(|| { loop { match stmt.step().unwrap() { - limbo_core::StepResult::Row => {} - limbo_core::StepResult::IO => { + turso_core::StepResult::Row => {} + turso_core::StepResult::IO => { let _ = io.run_once(); } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { break; } - limbo_core::StepResult::Interrupt | limbo_core::StepResult::Busy => { + turso_core::StepResult::Interrupt | turso_core::StepResult::Busy => { unreachable!(); } } @@ -610,14 +610,14 @@ fn bench_sequential_jsonb(criterion: &mut Criterion) { b.iter(|| { loop { match stmt.step().unwrap() { - limbo_core::StepResult::Row => {} - limbo_core::StepResult::IO => { + turso_core::StepResult::Row => {} + turso_core::StepResult::IO => { let _ = io.run_once(); } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { break; } - limbo_core::StepResult::Interrupt | limbo_core::StepResult::Busy => { + turso_core::StepResult::Interrupt | turso_core::StepResult::Busy => { unreachable!(); } } @@ -903,14 +903,14 @@ fn bench_json_patch(criterion: &mut Criterion) { b.iter(|| { loop { match stmt.step().unwrap() { - limbo_core::StepResult::Row => {} - limbo_core::StepResult::IO => { + turso_core::StepResult::Row => {} + turso_core::StepResult::IO => { let _ = io.run_once(); } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { break; } - limbo_core::StepResult::Interrupt | limbo_core::StepResult::Busy => { + turso_core::StepResult::Interrupt | turso_core::StepResult::Busy => { unreachable!(); } } diff --git a/core/benches/mvcc_benchmark.rs b/core/benches/mvcc_benchmark.rs index 3afd9b9cd..15faffbac 100644 --- a/core/benches/mvcc_benchmark.rs +++ b/core/benches/mvcc_benchmark.rs @@ -1,12 +1,12 @@ use criterion::async_executor::FuturesExecutor; use criterion::{criterion_group, criterion_main, Criterion, Throughput}; -use limbo_core::mvcc::clock::LocalClock; -use limbo_core::mvcc::database::{MvStore, Row, RowID}; use pprof::criterion::{Output, PProfProfiler}; +use turso_core::mvcc::clock::LocalClock; +use turso_core::mvcc::database::{MvStore, Row, RowID}; fn bench_db() -> MvStore { let clock = LocalClock::default(); - let storage = limbo_core::mvcc::persistent_storage::Storage::new_noop(); + let storage = turso_core::mvcc::persistent_storage::Storage::new_noop(); MvStore::new(clock, storage) } diff --git a/core/benches/tpc_h_benchmark.rs b/core/benches/tpc_h_benchmark.rs index c3c63f110..4084e4c59 100644 --- a/core/benches/tpc_h_benchmark.rs +++ b/core/benches/tpc_h_benchmark.rs @@ -1,8 +1,8 @@ use std::sync::Arc; use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, SamplingMode}; -use limbo_core::{Database, PlatformIO, IO as _}; use pprof::criterion::{Output, PProfProfiler}; +use turso_core::{Database, PlatformIO, IO as _}; const TPC_H_PATH: &str = "../perf/tpc-h/TPC-H.db"; @@ -93,16 +93,16 @@ fn bench_tpc_h_queries(criterion: &mut Criterion) { let mut stmt = limbo_conn.prepare(query).unwrap(); loop { match stmt.step().unwrap() { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { black_box(stmt.row()); } - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { let _ = io.run_once(); } - limbo_core::StepResult::Done => { + turso_core::StepResult::Done => { break; } - limbo_core::StepResult::Interrupt | limbo_core::StepResult::Busy => { + turso_core::StepResult::Interrupt | turso_core::StepResult::Busy => { unreachable!(); } } diff --git a/docs/testing.md b/docs/testing.md index 770ffff0a..9ce98a21a 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -64,10 +64,10 @@ Use these Python-based tests for validating: If you wish to trace internal events during test execution, you can set the RUST_LOG environment variable before running the test. For example: ```bash -RUST_LOG=none,limbo_core=trace make test +RUST_LOG=none,turso_core=trace make test ``` -This will enable trace-level logs for the limbo_core crate and disable logs elsewhere. Logging all internal traces to the `testing/test.log` file. +This will enable trace-level logs for the turso_core crate and disable logs elsewhere. Logging all internal traces to the `testing/test.log` file. **Note:** trace logs can be very verbose—it's not uncommon for a single test run to generate megabytes of logs. diff --git a/extensions/core/README.md b/extensions/core/README.md index 5fd62214c..80201365b 100644 --- a/extensions/core/README.md +++ b/extensions/core/README.md @@ -419,7 +419,7 @@ Edit the workspace `Cargo.toml` to include your extension as a workspace depende ```diff [workspace.dependencies] -limbo_core = { path = "core", version = "0.0.17" } +turso_core = { path = "core", version = "0.0.17" } limbo_crypto = { path = "extensions/crypto", version = "0.0.17" } limbo_ext = { path = "extensions/core", version = "0.0.17" } limbo_macros = { path = "macros", version = "0.0.17" } diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 507975013..1c0519750 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -560,49 +560,13 @@ version = "0.0.0" dependencies = [ "arbitrary", "libfuzzer-sys", - "limbo_core", "rusqlite", -] - -[[package]] -name = "limbo_core" -version = "0.0.21" -dependencies = [ - "bitflags", - "built", - "cfg_block", - "chrono", - "crossbeam-skiplist", - "fallible-iterator", - "getrandom 0.2.15", - "hex", - "julian_day_converter", - "libloading", - "libm", - "limbo_ext", - "limbo_macros", - "limbo_sqlite3_parser", - "limbo_time", - "limbo_uuid", - "miette", - "mimalloc", - "parking_lot", - "polling", - "rand", - "regex", - "regex-syntax", - "rustix 1.0.7", - "ryu", - "strum", - "strum_macros", - "thiserror 1.0.69", - "tracing", - "uncased", + "turso_core", ] [[package]] name = "limbo_ext" -version = "0.0.21" +version = "0.1.0-pre.2" dependencies = [ "chrono", "getrandom 0.3.1", @@ -611,16 +575,24 @@ dependencies = [ [[package]] name = "limbo_macros" -version = "0.0.21" +version = "0.1.0-pre.2" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "limbo_series" +version = "0.1.0-pre.2" +dependencies = [ + "limbo_ext", + "mimalloc", +] + [[package]] name = "limbo_sqlite3_parser" -version = "0.0.21" +version = "0.1.0-pre.2" dependencies = [ "bitflags", "cc", @@ -639,7 +611,7 @@ dependencies = [ [[package]] name = "limbo_time" -version = "0.0.21" +version = "0.1.0-pre.2" dependencies = [ "chrono", "limbo_ext", @@ -651,7 +623,7 @@ dependencies = [ [[package]] name = "limbo_uuid" -version = "0.0.21" +version = "0.1.0-pre.2" dependencies = [ "limbo_ext", "mimalloc", @@ -767,6 +739,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1161,6 +1139,44 @@ dependencies = [ "once_cell", ] +[[package]] +name = "turso_core" +version = "0.1.0-pre.2" +dependencies = [ + "bitflags", + "built", + "cfg_block", + "chrono", + "crossbeam-skiplist", + "fallible-iterator", + "getrandom 0.2.15", + "hex", + "julian_day_converter", + "libloading", + "libm", + "limbo_ext", + "limbo_macros", + "limbo_series", + "limbo_sqlite3_parser", + "limbo_time", + "limbo_uuid", + "miette", + "mimalloc", + "parking_lot", + "paste", + "polling", + "rand", + "regex", + "regex-syntax", + "rustix 1.0.7", + "ryu", + "strum", + "strum_macros", + "thiserror 1.0.69", + "tracing", + "uncased", +] + [[package]] name = "uncased" version = "0.9.10" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 7c157b8eb..1543a2841 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -11,7 +11,7 @@ cargo-fuzz = true [dependencies] libfuzzer-sys = "0.4" arbitrary = { version = "1.4.1", features = ["derive"] } -limbo_core = { path = "../core", features = ["fuzz"] } +turso_core = { path = "../core", features = ["fuzz"] } rusqlite = { version = "0.34.0", features = ["bundled"] } # Prevent this from interfering with workspaces diff --git a/fuzz/fuzz_targets/cast_real.rs b/fuzz/fuzz_targets/cast_real.rs index 4ef4ab2ba..41fa0cbd2 100644 --- a/fuzz/fuzz_targets/cast_real.rs +++ b/fuzz/fuzz_targets/cast_real.rs @@ -1,6 +1,6 @@ #![no_main] use libfuzzer_sys::{fuzz_target, Corpus}; -use limbo_core::numeric::StrToF64; +use turso_core::numeric::StrToF64; use std::error::Error; fn do_fuzz(text: String) -> Result> { @@ -11,7 +11,7 @@ fn do_fuzz(text: String) -> Result> { })? }; - let actual = limbo_core::numeric::str_to_f64(&text) + let actual = turso_core::numeric::str_to_f64(&text) .map(|v| { let (StrToF64::Fractional(non_nan) | StrToF64::Decimal(non_nan)) = v; f64::from(non_nan) diff --git a/fuzz/fuzz_targets/expression.rs b/fuzz/fuzz_targets/expression.rs index 4715e9673..cf56eebb4 100644 --- a/fuzz/fuzz_targets/expression.rs +++ b/fuzz/fuzz_targets/expression.rs @@ -4,7 +4,7 @@ use std::{error::Error, num::NonZero, sync::Arc}; use arbitrary::Arbitrary; use libfuzzer_sys::{fuzz_target, Corpus}; -use limbo_core::{Value, IO as _}; +use turso_core::{Value, IO as _}; macro_rules! str_enum { ($vis:vis enum $name:ident { $($variant:ident => $value:literal),*, }) => { @@ -72,20 +72,20 @@ enum Value { Blob(Vec), } -impl From for limbo_core::Value { - fn from(value: Value) -> limbo_core::Value { +impl From for turso_core::Value { + fn from(value: Value) -> turso_core::Value { match value { - Value::Null => limbo_core::Value::Null, - Value::Integer(v) => limbo_core::Value::Integer(v), + Value::Null => turso_core::Value::Null, + Value::Integer(v) => turso_core::Value::Integer(v), Value::Real(v) => { if v.is_nan() { - limbo_core::Value::Null + turso_core::Value::Null } else { - limbo_core::Value::Float(v) + turso_core::Value::Float(v) } } - Value::Text(v) => limbo_core::Value::from_text(&v), - Value::Blob(v) => limbo_core::Value::from_blob(v.to_owned()), + Value::Text(v) => turso_core::Value::from_text(&v), + Value::Blob(v) => turso_core::Value::from_blob(v.to_owned()), } } } @@ -168,7 +168,7 @@ fn do_fuzz(expr: Expr) -> Result> { let expr = expr.lower(); let sql = format!("SELECT {}", expr.query); - // FIX: `limbo_core::translate::expr::translate_expr` causes a overflow if this is any higher. + // FIX: `turso_core::translate::expr::translate_expr` causes a overflow if this is any higher. if expr.depth > 140 { return Ok(Corpus::Reject); } @@ -183,8 +183,8 @@ fn do_fuzz(expr: Expr) -> Result> { }; let found = 'value: { - let io = Arc::new(limbo_core::MemoryIO::new()); - let db = limbo_core::Database::open_file(io.clone(), ":memory:", false)?; + let io = Arc::new(turso_core::MemoryIO::new()); + let db = turso_core::Database::open_file(io.clone(), ":memory:", false)?; let conn = db.connect()?; let mut stmt = conn.prepare(sql)?; @@ -192,7 +192,7 @@ fn do_fuzz(expr: Expr) -> Result> { stmt.bind_at(NonZero::new(idx + 1).unwrap(), value.clone().into()) } loop { - use limbo_core::StepResult; + use turso_core::StepResult; match stmt.step()? { StepResult::IO => io.run_once()?, StepResult::Row => { diff --git a/fuzz/fuzz_targets/schema.rs b/fuzz/fuzz_targets/schema.rs index c5ff3c731..8edf7553b 100644 --- a/fuzz/fuzz_targets/schema.rs +++ b/fuzz/fuzz_targets/schema.rs @@ -337,8 +337,8 @@ impl<'a> Arbitrary<'a> for Ops { fn do_fuzz(Ops(ops): Ops) -> Result> { let rusqlite_conn = rusqlite::Connection::open_in_memory()?; - let io = Arc::new(limbo_core::MemoryIO::new()); - let db = limbo_core::Database::open_file(io.clone(), ":memory:", false)?; + let io = Arc::new(turso_core::MemoryIO::new()); + let db = turso_core::Database::open_file(io.clone(), ":memory:", false)?; let limbo_conn = db.connect()?; for op in ops { diff --git a/perf/latency/limbo/Cargo.lock b/perf/latency/limbo/Cargo.lock index 540687f3d..6acb73773 100644 --- a/perf/latency/limbo/Cargo.lock +++ b/perf/latency/limbo/Cargo.lock @@ -94,23 +94,18 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] -name = "bitflags" -version = "2.4.0" +name = "built" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "56ed6191a7e78c36abdb16ab65341eefd73d64d303fffccdbb00d51e4205967b" dependencies = [ - "generic-array", + "chrono", + "git2", ] [[package]] @@ -127,11 +122,13 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.0.83" +version = "1.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" dependencies = [ + "jobserver", "libc", + "shlex", ] [[package]] @@ -140,12 +137,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "cfg_block" version = "0.1.1" @@ -154,16 +145,16 @@ checksum = "18758054972164c3264f7c8386f5fc6da6114cb46b619fd365d4e3b2dc3ae487" [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.0", + "windows-link", ] [[package]] @@ -227,15 +218,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "cpufeatures" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6" -dependencies = [ - "libc", -] - [[package]] name = "crc32fast" version = "1.3.2" @@ -255,6 +237,25 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-skiplist" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df29de440c58ca2cc6e587ec3d22347551a32435fbde9d2bff64e78a9ffa151b" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.19" @@ -262,23 +263,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] -name = "crypto-common" -version = "0.1.6" +name = "displaydoc" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -312,9 +304,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", "windows-sys 0.52.0", @@ -326,12 +318,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" -[[package]] -name = "fast-float2" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8eb564c5c7423d25c886fb561d1e4ee69f72354d16918afa32c08811f6b6a55" - [[package]] name = "flate2" version = "1.0.27" @@ -343,13 +329,12 @@ dependencies = [ ] [[package]] -name = "generic-array" -version = "0.14.7" +name = "form_urlencoded" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "typenum", - "version_check", + "percent-encoding", ] [[package]] @@ -359,10 +344,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", - "js-sys", "libc", - "wasi", - "wasm-bindgen", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + +[[package]] +name = "git2" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "url", ] [[package]] @@ -393,9 +401,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.4.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" [[package]] name = "hex" @@ -432,6 +440,113 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" + +[[package]] +name = "icu_properties" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "potential_utf", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" + +[[package]] +name = "icu_provider" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +dependencies = [ + "displaydoc", + "icu_locale_core", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "indexmap" version = "2.6.0" @@ -440,73 +555,91 @@ checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", "hashbrown", - "serde", ] [[package]] -name = "io-uring" -version = "0.6.2" +name = "jobserver" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460648e47a07a43110fbfa2e0b14afb2be920093c31e5dccc50e49568e099762" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" dependencies = [ - "bitflags 1.3.2", + "getrandom 0.3.3", "libc", ] -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] -[[package]] -name = "jsonb" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd7dc2490b13d09367f5dc4bf202a5d70958dd5b9b2758e2708ee062752a824" -dependencies = [ - "byteorder", - "fast-float2", - "itoa", - "nom", - "ordered-float", - "rand", - "ryu", - "serde_json", -] - [[package]] name = "julian_day_converter" -version = "0.3.2" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b8b1d2decaeec65c1d9729098450800ffb40767dcab1b9be3e6e7eb21c6e7a5" +checksum = "f2987f71b89b85c812c8484cbf0c5d7912589e77bfdc66fd3e52f760e7859f16" dependencies = [ "chrono", ] [[package]] name = "libc" -version = "0.2.155" +version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" [[package]] -name = "libmimalloc-sys" -version = "0.1.35" +name = "libgit2-sys" +version = "0.18.2+1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664" +checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222" dependencies = [ "cc", "libc", + "libz-sys", + "pkg-config", +] + +[[package]] +name = "libloading" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" +dependencies = [ + "cfg-if", + "windows-targets 0.48.5", +] + +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "libmimalloc-sys" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88cd67e9de251c1781dbe2f641a1a3ad66eaae831b8a2c38fbdc5ddae16d4d" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "libz-sys" +version = "1.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", ] [[package]] @@ -516,43 +649,96 @@ dependencies = [ "clap", "env_logger", "hdrhistogram", - "limbo_core", + "turso_core", ] [[package]] -name = "limbo_core" -version = "0.0.8" +name = "limbo_ext" +version = "0.1.0-pre.2" dependencies = [ - "cfg_block", "chrono", - "fallible-iterator", - "getrandom", - "hex", - "indexmap", - "io-uring", - "jsonb", - "julian_day_converter", - "libc", - "log", + "getrandom 0.3.3", + "limbo_macros", +] + +[[package]] +name = "limbo_macros" +version = "0.1.0-pre.2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "limbo_series" +version = "0.1.0-pre.2" +dependencies = [ + "limbo_ext", "mimalloc", - "nix", - "pest", - "pest_derive", - "polling", - "rand", - "regex", - "rustix", - "serde", - "sieve-cache", - "sqlite3-parser", - "thiserror", +] + +[[package]] +name = "limbo_sqlite3_parser" +version = "0.1.0-pre.2" +dependencies = [ + "bitflags", + "cc", + "fallible-iterator", + "indexmap", + "log", + "memchr", + "miette", + "phf", + "phf_codegen", + "phf_shared", + "strum", + "strum_macros", + "uncased", +] + +[[package]] +name = "limbo_time" +version = "0.1.0-pre.2" +dependencies = [ + "chrono", + "limbo_ext", + "mimalloc", + "strum", + "strum_macros", + "thiserror 2.0.12", +] + +[[package]] +name = "limbo_uuid" +version = "0.1.0-pre.2" +dependencies = [ + "limbo_ext", + "mimalloc", + "uuid", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "litemap" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "lock_api" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +dependencies = [ + "autocfg", + "scopeguard", +] [[package]] name = "log" @@ -567,10 +753,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] -name = "mimalloc" -version = "0.1.39" +name = "miette" +version = "7.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c" +checksum = "5f98efec8807c63c752b5bd61f862c165c115b0a35685bdcfd9238c7aeb592b7" +dependencies = [ + "cfg-if", + "miette-derive", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "7.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db5b29714e950dbb20d5e6f74f9dcec4edbcc1067bb7f8ed198c097b8c1a818b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "mimalloc" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1791cbe101e95af5764f06f20f6760521f7158f69dbf9d6baf941ee1bf6bc40" dependencies = [ "libmimalloc-sys", ] @@ -590,18 +798,6 @@ dependencies = [ "adler", ] -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.4.0", - "cfg-if", - "cfg_aliases", - "libc", -] - [[package]] name = "nom" version = "7.1.3" @@ -628,58 +824,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] -name = "ordered-float" -version = "4.5.0" +name = "parking_lot" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c65ee1f9701bf938026630b455d5315f490640234259037edb259798b3bcf85e" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" dependencies = [ - "num-traits", + "lock_api", + "parking_lot_core", ] [[package]] -name = "pest" -version = "2.7.14" +name = "parking_lot_core" +version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" dependencies = [ - "memchr", - "thiserror", - "ucd-trie", + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", ] [[package]] -name = "pest_derive" -version = "2.7.14" +name = "paste" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" -dependencies = [ - "pest", - "pest_generator", -] +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] -name = "pest_generator" -version = "2.7.14" +name = "percent-encoding" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" -dependencies = [ - "once_cell", - "pest", - "sha2", -] +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "phf" @@ -727,10 +904,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] -name = "polling" -version = "3.7.2" +name = "pkg-config" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "polling" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b53a684391ad002dd6a596ceb6c74fd004fdce75f4be2e3f615068abbea5fd50" dependencies = [ "cfg-if", "concurrent-queue", @@ -738,7 +921,16 @@ dependencies = [ "pin-project-lite", "rustix", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", +] + +[[package]] +name = "potential_utf" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +dependencies = [ + "zerovec", ] [[package]] @@ -752,22 +944,28 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "rand" version = "0.8.5" @@ -795,14 +993,23 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", +] + +[[package]] +name = "redox_syscall" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" +dependencies = [ + "bitflags", ] [[package]] name = "regex" -version = "1.10.5" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -812,9 +1019,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.4" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -823,17 +1030,17 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustix" -version = "0.38.34" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ - "bitflags 2.4.0", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -841,10 +1048,22 @@ dependencies = [ ] [[package]] -name = "ryu" -version = "1.0.18" +name = "rustversion" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" @@ -867,34 +1086,10 @@ dependencies = [ ] [[package]] -name = "serde_json" -version = "1.0.132" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" -dependencies = [ - "indexmap", - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sieve-cache" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bf3a9dccf2c079bf1465d449a485c85b36443caf765f2f127bfec28b180f75" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "siphasher" @@ -903,20 +1098,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] -name = "sqlite3-parser" -version = "0.13.0" -dependencies = [ - "bitflags 2.4.0", - "cc", - "fallible-iterator", - "indexmap", - "log", - "memchr", - "phf", - "phf_codegen", - "phf_shared", - "uncased", -] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "strsim" @@ -925,23 +1116,65 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "syn" -version = "2.0.48" +name = "strum" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "syn" +version = "2.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thiserror" version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.63", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl 2.0.12", ] [[package]] @@ -956,32 +1189,94 @@ dependencies = [ ] [[package]] -name = "tracing" -version = "0.1.40" +name = "thiserror-impl" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] [[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "ucd-trie" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" +name = "turso_core" +version = "0.1.0-pre.2" +dependencies = [ + "bitflags", + "built", + "cfg_block", + "chrono", + "crossbeam-skiplist", + "fallible-iterator", + "getrandom 0.2.15", + "hex", + "julian_day_converter", + "libloading", + "libm", + "limbo_ext", + "limbo_macros", + "limbo_series", + "limbo_sqlite3_parser", + "limbo_time", + "limbo_uuid", + "miette", + "mimalloc", + "parking_lot", + "paste", + "polling", + "rand", + "regex", + "regex-syntax", + "rustix", + "ryu", + "strum", + "strum_macros", + "thiserror 1.0.63", + "tracing", + "uncased", +] [[package]] name = "uncased" @@ -998,12 +1293,52 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "uuid" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" +dependencies = [ + "getrandom 0.3.3", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" @@ -1017,24 +1352,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "wasm-bindgen" -version = "0.2.92" +name = "wasi" +version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn", @@ -1043,9 +1388,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1053,9 +1398,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", @@ -1066,9 +1411,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "windows-core" @@ -1076,9 +1424,15 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", ] +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + [[package]] name = "windows-sys" version = "0.48.0" @@ -1094,7 +1448,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -1114,17 +1477,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -1135,9 +1499,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -1147,9 +1511,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -1159,9 +1523,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -1171,9 +1541,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -1183,9 +1553,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -1195,9 +1565,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -1207,9 +1577,48 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "writeable" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" + +[[package]] +name = "yoke" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] [[package]] name = "zerocopy" @@ -1231,3 +1640,57 @@ dependencies = [ "quote", "syn", ] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/perf/latency/limbo/Cargo.toml b/perf/latency/limbo/Cargo.toml index 3d5229912..834ae8813 100644 --- a/perf/latency/limbo/Cargo.toml +++ b/perf/latency/limbo/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" clap = { version = "4.5", features = ["derive"] } env_logger = "0.11.0" hdrhistogram = "7.5.2" -limbo_core = { path = "../../../core" } +turso_core = { path = "../../../core" } [profile.release] debug = true diff --git a/perf/latency/limbo/src/main.rs b/perf/latency/limbo/src/main.rs index 834c12225..3616b6a3f 100644 --- a/perf/latency/limbo/src/main.rs +++ b/perf/latency/limbo/src/main.rs @@ -4,7 +4,7 @@ use clap::Parser; use hdrhistogram::Histogram; -use limbo_core::{Database, PlatformIO, IO}; +use turso_core::{Database, PlatformIO, IO}; use std::ops::{Coroutine, CoroutineState}; use std::pin::Pin; use std::sync::Arc; @@ -38,12 +38,12 @@ fn main() { loop { let row = rows.step().unwrap(); match row { - limbo_core::StepResult::Row(_) => { + turso_core::StepResult::Row(_) => { let row = statement.row(); count += 1; } - limbo_core::StepResult::IO => yield, - limbo_core::StepResult::Done => break, + turso_core::StepResult::IO => yield, + turso_core::StepResult::Done => break, } } assert!(count == 100); diff --git a/scripts/publish-crates.sh b/scripts/publish-crates.sh index efd3cb3d9..d238b3da5 100755 --- a/scripts/publish-crates.sh +++ b/scripts/publish-crates.sh @@ -13,5 +13,5 @@ cargo publish -p limbo_time cargo publish -p limbo_uuid cargo publish -p limbo_ipaddr cargo publish -p limbo_sqlite3_parser -cargo publish -p limbo_core +cargo publish -p turso_core cargo publish -p limbo diff --git a/simulator/Cargo.toml b/simulator/Cargo.toml index b15f32b56..9ce503836 100644 --- a/simulator/Cargo.toml +++ b/simulator/Cargo.toml @@ -15,7 +15,7 @@ name = "limbo_sim" path = "main.rs" [dependencies] -limbo_core = { path = "../core", features = ["simulator"]} +turso_core = { path = "../core", features = ["simulator"]} rand = "0.8.5" rand_chacha = "0.3.1" log = "0.4.20" diff --git a/simulator/generation/plan.rs b/simulator/generation/plan.rs index fd229a685..c0e7e55bc 100644 --- a/simulator/generation/plan.rs +++ b/simulator/generation/plan.rs @@ -6,8 +6,8 @@ use std::{ vec, }; -use limbo_core::{Connection, Result, StepResult, IO}; use serde::{Deserialize, Serialize}; +use turso_core::{Connection, Result, StepResult, IO}; use crate::{ model::{ @@ -564,10 +564,10 @@ impl Interaction { let result = assertion.func.as_ref()(stack, env); match result { Ok(true) => Ok(()), - Ok(false) => Err(limbo_core::LimboError::InternalError( + Ok(false) => Err(turso_core::LimboError::InternalError( assertion.message.clone(), )), - Err(err) => Err(limbo_core::LimboError::InternalError(format!( + Err(err) => Err(turso_core::LimboError::InternalError(format!( "{}. Inner error: {}", assertion.message, err ))), @@ -598,10 +598,10 @@ impl Interaction { let result = assumption.func.as_ref()(stack, env); match result { Ok(true) => Ok(()), - Ok(false) => Err(limbo_core::LimboError::InternalError( + Ok(false) => Err(turso_core::LimboError::InternalError( assumption.message.clone(), )), - Err(err) => Err(limbo_core::LimboError::InternalError(format!( + Err(err) => Err(turso_core::LimboError::InternalError(format!( "{}. Inner error: {}", assumption.message, err ))), @@ -630,7 +630,7 @@ impl Interaction { if env.connections[conn_index].is_connected() { env.connections[conn_index].disconnect(); } else { - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "connection already disconnected".into(), )); } @@ -644,7 +644,7 @@ impl Interaction { // 2. Re-open database let db_path = env.db_path.clone(); - let db = match limbo_core::Database::open_file( + let db = match turso_core::Database::open_file( env.io.clone(), &db_path, false, diff --git a/simulator/generation/property.rs b/simulator/generation/property.rs index 4a78ad7bd..8eecc7ec1 100644 --- a/simulator/generation/property.rs +++ b/simulator/generation/property.rs @@ -1,6 +1,6 @@ -use limbo_core::LimboError; use limbo_sqlite3_parser::ast; use serde::{Deserialize, Serialize}; +use turso_core::LimboError; use crate::{ model::{ diff --git a/simulator/generation/table.rs b/simulator/generation/table.rs index eacfc1627..8cf830d25 100644 --- a/simulator/generation/table.rs +++ b/simulator/generation/table.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; -use limbo_core::Value; use rand::Rng; +use turso_core::Value; use crate::generation::{gen_random_text, pick, readable_name_custom, Arbitrary, ArbitraryFrom}; use crate::model::table::{Column, ColumnType, Name, SimValue, Table}; diff --git a/simulator/model/table.rs b/simulator/model/table.rs index 98462394a..7308f7b9f 100644 --- a/simulator/model/table.rs +++ b/simulator/model/table.rs @@ -1,8 +1,8 @@ use std::{fmt::Display, hash::Hash, ops::Deref}; -use limbo_core::{numeric::Numeric, types}; use limbo_sqlite3_parser::ast; use serde::{Deserialize, Serialize}; +use turso_core::{numeric::Numeric, types}; pub(crate) struct Name(pub(crate) String); @@ -79,7 +79,7 @@ where } #[derive(Clone, Debug, PartialEq, PartialOrd, Serialize, Deserialize)] -pub(crate) struct SimValue(pub limbo_core::Value); +pub(crate) struct SimValue(pub turso_core::Value); fn to_sqlite_blob(bytes: &[u8]) -> String { format!( @@ -116,7 +116,7 @@ impl SimValue { /// TODO: forget collations for now /// TODO: have the [ast::Operator::Equals], [ast::Operator::NotEquals], [ast::Operator::Greater], /// [ast::Operator::GreaterEquals], [ast::Operator::Less], [ast::Operator::LessEquals] function to be extracted - /// into its functions in limbo_core so that it can be used here + /// into its functions in turso_core so that it can be used here pub fn binary_compare(&self, other: &Self, operator: ast::Operator) -> SimValue { match operator { ast::Operator::Add => self.0.exec_add(&other.0).into(), @@ -290,26 +290,26 @@ impl From for SimValue { } } -impl From for limbo_core::types::Value { +impl From for turso_core::types::Value { fn from(value: SimValue) -> Self { value.0 } } -impl From<&SimValue> for limbo_core::types::Value { +impl From<&SimValue> for turso_core::types::Value { fn from(value: &SimValue) -> Self { value.0.clone() } } -impl From for SimValue { - fn from(value: limbo_core::types::Value) -> Self { +impl From for SimValue { + fn from(value: turso_core::types::Value) -> Self { Self(value) } } -impl From<&limbo_core::types::Value> for SimValue { - fn from(value: &limbo_core::types::Value) -> Self { +impl From<&turso_core::types::Value> for SimValue { + fn from(value: &turso_core::types::Value) -> Self { Self(value.clone()) } } diff --git a/simulator/runner/differential.rs b/simulator/runner/differential.rs index 443b07675..6d48ca99a 100644 --- a/simulator/runner/differential.rs +++ b/simulator/runner/differential.rs @@ -1,6 +1,6 @@ use std::sync::{Arc, Mutex}; -use limbo_core::Value; +use turso_core::Value; use crate::{ generation::{ @@ -163,7 +163,7 @@ pub(crate) fn execute_plans( if now.elapsed().as_secs() >= env.opts.max_time_simulation as u64 { return ExecutionResult::new( history, - Some(limbo_core::LimboError::InternalError( + Some(turso_core::LimboError::InternalError( "maximum time for simulation reached".into(), )), ); @@ -181,7 +181,7 @@ fn execute_plan( plans: &mut [InteractionPlan], states: &mut [InteractionPlanState], rusqlite_states: &mut [InteractionPlanState], -) -> limbo_core::Result<()> { +) -> turso_core::Result<()> { let connection = &env.connections[connection_index]; let rusqlite_connection = &rusqlite_env.connections[connection_index]; let plan = &mut plans[connection_index]; @@ -214,7 +214,7 @@ fn execute_plan( (Ok(next_execution), Ok(next_execution_rusqlite)) => { if next_execution != next_execution_rusqlite { tracing::error!("limbo and rusqlite results do not match"); - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "limbo and rusqlite results do not match".into(), )); } @@ -227,7 +227,7 @@ fn execute_plan( (Ok(limbo_values), Ok(rusqlite_values)) => { if limbo_values != rusqlite_values { tracing::error!("limbo and rusqlite results do not match"); - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "limbo and rusqlite results do not match".into(), )); } @@ -243,14 +243,14 @@ fn execute_plan( tracing::error!("limbo and rusqlite results do not match"); tracing::error!("limbo values {:?}", limbo_result); tracing::error!("rusqlite error {}", rusqlite_err); - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "limbo and rusqlite results do not match".into(), )); } (Err(limbo_err), Ok(_)) => { tracing::error!("limbo and rusqlite results do not match"); tracing::error!("limbo error {}", limbo_err); - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "limbo and rusqlite results do not match".into(), )); } @@ -259,7 +259,7 @@ fn execute_plan( (None, None) => {} _ => { tracing::error!("limbo and rusqlite results do not match"); - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "limbo and rusqlite results do not match".into(), )); } @@ -316,7 +316,7 @@ fn execute_interaction_rusqlite( connection_index: usize, interaction: &Interaction, stack: &mut Vec, -) -> limbo_core::Result { +) -> turso_core::Result { tracing::trace!( "execute_interaction_rusqlite(connection_index={}, interaction={})", connection_index, @@ -332,7 +332,7 @@ fn execute_interaction_rusqlite( tracing::debug!("{}", interaction); let results = execute_query_rusqlite(conn, query).map_err(|e| { - limbo_core::LimboError::InternalError(format!("error executing query: {}", e)) + turso_core::LimboError::InternalError(format!("error executing query: {}", e)) }); tracing::debug!("{:?}", results); stack.push(results); diff --git a/simulator/runner/env.rs b/simulator/runner/env.rs index 606aec768..aeb0a1052 100644 --- a/simulator/runner/env.rs +++ b/simulator/runner/env.rs @@ -3,9 +3,9 @@ use std::mem; use std::path::Path; use std::sync::Arc; -use limbo_core::Database; use rand::{Rng, SeedableRng}; use rand_chacha::ChaCha8Rng; +use turso_core::Database; use crate::model::table::Table; @@ -168,7 +168,7 @@ where } pub(crate) enum SimConnection { - LimboConnection(Arc), + LimboConnection(Arc), SQLiteConnection(rusqlite::Connection), Disconnected, } diff --git a/simulator/runner/execution.rs b/simulator/runner/execution.rs index e9f51531d..fcf9e6314 100644 --- a/simulator/runner/execution.rs +++ b/simulator/runner/execution.rs @@ -1,7 +1,7 @@ use std::sync::{Arc, Mutex}; -use limbo_core::{Connection, LimboError, Result, StepResult}; use tracing::instrument; +use turso_core::{Connection, LimboError, Result, StepResult}; use crate::generation::{ pick_index, @@ -227,7 +227,7 @@ fn limbo_integrity_check(conn: &mut Arc) -> Result<()> { let row = rows.row().unwrap(); let val = match row.get_value(0) { - limbo_core::Value::Text(text) => text.as_str().to_string(), + turso_core::Value::Text(text) => text.as_str().to_string(), _ => unreachable!(), }; result.push(val); diff --git a/simulator/runner/file.rs b/simulator/runner/file.rs index 1f0ad838e..89d50ab6c 100644 --- a/simulator/runner/file.rs +++ b/simulator/runner/file.rs @@ -3,10 +3,10 @@ use std::{ sync::Arc, }; -use limbo_core::{CompletionType, File, Result}; use rand::Rng as _; use rand_chacha::ChaCha8Rng; use tracing::{instrument, Level}; +use turso_core::{CompletionType, File, Result}; pub(crate) struct SimulatorFile { pub(crate) inner: Arc, pub(crate) fault: Cell, @@ -82,7 +82,7 @@ impl SimulatorFile { impl File for SimulatorFile { fn lock_file(&self, exclusive: bool) -> Result<()> { if self.fault.get() { - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "Injected fault".into(), )); } @@ -91,7 +91,7 @@ impl File for SimulatorFile { fn unlock_file(&self) -> Result<()> { if self.fault.get() { - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "Injected fault".into(), )); } @@ -101,12 +101,12 @@ impl File for SimulatorFile { fn pread( &self, pos: usize, - mut c: limbo_core::Completion, - ) -> Result> { + mut c: turso_core::Completion, + ) -> Result> { self.nr_pread_calls.set(self.nr_pread_calls.get() + 1); if self.fault.get() { self.nr_pread_faults.set(self.nr_pread_faults.get() + 1); - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "Injected fault".into(), )); } @@ -134,13 +134,13 @@ impl File for SimulatorFile { fn pwrite( &self, pos: usize, - buffer: Arc>, - mut c: limbo_core::Completion, - ) -> Result> { + buffer: Arc>, + mut c: turso_core::Completion, + ) -> Result> { self.nr_pwrite_calls.set(self.nr_pwrite_calls.get() + 1); if self.fault.get() { self.nr_pwrite_faults.set(self.nr_pwrite_faults.get() + 1); - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "Injected fault".into(), )); } @@ -165,7 +165,7 @@ impl File for SimulatorFile { self.inner.pwrite(pos, buffer, c) } - fn sync(&self, mut c: limbo_core::Completion) -> Result> { + fn sync(&self, mut c: turso_core::Completion) -> Result> { self.nr_sync_calls.set(self.nr_sync_calls.get() + 1); if let Some(latency) = self.generate_latency_duration() { let CompletionType::Sync(sync_completion) = &mut c.completion_type else { diff --git a/simulator/runner/io.rs b/simulator/runner/io.rs index bd5710c40..774ec72a9 100644 --- a/simulator/runner/io.rs +++ b/simulator/runner/io.rs @@ -3,9 +3,9 @@ use std::{ sync::Arc, }; -use limbo_core::{Clock, Instant, OpenFlags, PlatformIO, Result, IO}; use rand::{RngCore, SeedableRng}; use rand_chacha::ChaCha8Rng; +use turso_core::{Clock, Instant, OpenFlags, PlatformIO, Result, IO}; use crate::runner::file::SimulatorFile; @@ -72,7 +72,7 @@ impl IO for SimulatorIO { path: &str, flags: OpenFlags, _direct: bool, - ) -> Result> { + ) -> Result> { let inner = self.inner.open_file(path, flags, false)?; let file = Arc::new(SimulatorFile { inner, @@ -90,7 +90,7 @@ impl IO for SimulatorIO { Ok(file) } - fn wait_for_completion(&self, c: Arc) -> Result<()> { + fn wait_for_completion(&self, c: Arc) -> Result<()> { while !c.is_completed() { self.run_once()?; } @@ -101,7 +101,7 @@ impl IO for SimulatorIO { if self.fault.get() { self.nr_run_once_faults .replace(self.nr_run_once_faults.get() + 1); - return Err(limbo_core::LimboError::InternalError( + return Err(turso_core::LimboError::InternalError( "Injected fault".into(), )); } @@ -113,7 +113,7 @@ impl IO for SimulatorIO { self.rng.borrow_mut().next_u64() as i64 } - fn get_memory_io(&self) -> Arc { + fn get_memory_io(&self) -> Arc { todo!() } } diff --git a/simulator/runner/watch.rs b/simulator/runner/watch.rs index 6660a918b..7c3795f01 100644 --- a/simulator/runner/watch.rs +++ b/simulator/runner/watch.rs @@ -70,7 +70,7 @@ pub(crate) fn execute_plans( if now.elapsed().as_secs() >= env.opts.max_time_simulation as u64 { return ExecutionResult::new( history, - Some(limbo_core::LimboError::InternalError( + Some(turso_core::LimboError::InternalError( "maximum time for simulation reached".into(), )), ); @@ -85,7 +85,7 @@ fn execute_plan( connection_index: usize, plans: &mut [Vec>], states: &mut [InteractionPlanState], -) -> limbo_core::Result<()> { +) -> turso_core::Result<()> { let connection = &env.connections[connection_index]; let plan = &mut plans[connection_index]; let state = &mut states[connection_index]; diff --git a/sqlite3/Cargo.toml b/sqlite3/Cargo.toml index bc6c63989..2c94c14a0 100644 --- a/sqlite3/Cargo.toml +++ b/sqlite3/Cargo.toml @@ -24,7 +24,7 @@ crate-type = ["lib", "cdylib", "staticlib"] [dependencies] env_logger = { version = "0.11.3", default-features = false } libc = "0.2.169" -limbo_core = { path = "../core" } +turso_core = { path = "../core" } tracing = "0.1.41" tracing-appender = "0.2.3" tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } diff --git a/sqlite3/src/lib.rs b/sqlite3/src/lib.rs index a9f536559..331eaa5cd 100644 --- a/sqlite3/src/lib.rs +++ b/sqlite3/src/lib.rs @@ -1,9 +1,9 @@ #![allow(clippy::missing_safety_doc)] #![allow(non_camel_case_types)] -use limbo_core::Value; use std::ffi::{self, CStr, CString}; use tracing::trace; +use turso_core::Value; use std::sync::{Arc, Mutex}; @@ -39,9 +39,9 @@ pub struct sqlite3 { } struct sqlite3Inner { - pub(crate) io: Arc, - pub(crate) _db: Arc, - pub(crate) conn: Arc, + pub(crate) io: Arc, + pub(crate) _db: Arc, + pub(crate) conn: Arc, pub(crate) err_code: ffi::c_int, pub(crate) err_mask: ffi::c_int, pub(crate) malloc_failed: bool, @@ -51,9 +51,9 @@ struct sqlite3Inner { impl sqlite3 { pub fn new( - io: Arc, - db: Arc, - conn: Arc, + io: Arc, + db: Arc, + conn: Arc, ) -> Self { let inner = sqlite3Inner { io, @@ -73,11 +73,11 @@ impl sqlite3 { pub struct sqlite3_stmt { pub(crate) db: *mut sqlite3, - pub(crate) stmt: limbo_core::Statement, + pub(crate) stmt: turso_core::Statement, } impl sqlite3_stmt { - pub fn new(db: *mut sqlite3, stmt: limbo_core::Statement) -> Self { + pub fn new(db: *mut sqlite3, stmt: turso_core::Statement) -> Self { Self { db, stmt } } } @@ -119,14 +119,14 @@ pub unsafe extern "C" fn sqlite3_open( Ok(s) => s, Err(_) => return SQLITE_MISUSE, }; - let io: Arc = match filename { - ":memory:" => Arc::new(limbo_core::MemoryIO::new()), - _ => match limbo_core::PlatformIO::new() { + let io: Arc = match filename { + ":memory:" => Arc::new(turso_core::MemoryIO::new()), + _ => match turso_core::PlatformIO::new() { Ok(io) => Arc::new(io), Err(_) => return SQLITE_CANTOPEN, }, }; - match limbo_core::Database::open_file(io.clone(), filename, false, false) { + match turso_core::Database::open_file(io.clone(), filename, false, false) { Ok(db) => { let conn = db.connect().unwrap(); *db_out = Box::leak(Box::new(sqlite3::new(io, db, conn))); @@ -250,15 +250,15 @@ pub unsafe extern "C" fn sqlite3_step(stmt: *mut sqlite3_stmt) -> ffi::c_int { let db = db.inner.lock().unwrap(); if let Ok(result) = stmt.stmt.step() { match result { - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { let io = db.io.clone(); io.run_once().unwrap(); continue; } - limbo_core::StepResult::Done => return SQLITE_DONE, - limbo_core::StepResult::Interrupt => return SQLITE_INTERRUPT, - limbo_core::StepResult::Row => return SQLITE_ROW, - limbo_core::StepResult::Busy => return SQLITE_BUSY, + turso_core::StepResult::Done => return SQLITE_DONE, + turso_core::StepResult::Interrupt => return SQLITE_INTERRUPT, + turso_core::StepResult::Row => return SQLITE_ROW, + turso_core::StepResult::Busy => return SQLITE_BUSY, } } else { return SQLITE_ERROR; @@ -588,63 +588,63 @@ pub unsafe extern "C" fn sqlite3_column_bytes( #[no_mangle] pub unsafe extern "C" fn sqlite3_value_type(value: *mut ffi::c_void) -> ffi::c_int { - let value = value as *mut limbo_core::Value; + let value = value as *mut turso_core::Value; let value = &*value; match value { - limbo_core::Value::Null => 0, - limbo_core::Value::Integer(_) => 1, - limbo_core::Value::Float(_) => 2, - limbo_core::Value::Text(_) => 3, - limbo_core::Value::Blob(_) => 4, + turso_core::Value::Null => 0, + turso_core::Value::Integer(_) => 1, + turso_core::Value::Float(_) => 2, + turso_core::Value::Text(_) => 3, + turso_core::Value::Blob(_) => 4, } } #[no_mangle] pub unsafe extern "C" fn sqlite3_value_int64(value: *mut ffi::c_void) -> i64 { - let value = value as *mut limbo_core::Value; + let value = value as *mut turso_core::Value; let value = &*value; match value { - limbo_core::Value::Integer(i) => *i, + turso_core::Value::Integer(i) => *i, _ => 0, } } #[no_mangle] pub unsafe extern "C" fn sqlite3_value_double(value: *mut ffi::c_void) -> f64 { - let value = value as *mut limbo_core::Value; + let value = value as *mut turso_core::Value; let value = &*value; match value { - limbo_core::Value::Float(f) => *f, + turso_core::Value::Float(f) => *f, _ => 0.0, } } #[no_mangle] pub unsafe extern "C" fn sqlite3_value_text(value: *mut ffi::c_void) -> *const ffi::c_uchar { - let value = value as *mut limbo_core::Value; + let value = value as *mut turso_core::Value; let value = &*value; match value { - limbo_core::Value::Text(text) => text.as_str().as_ptr(), + turso_core::Value::Text(text) => text.as_str().as_ptr(), _ => std::ptr::null(), } } #[no_mangle] pub unsafe extern "C" fn sqlite3_value_blob(value: *mut ffi::c_void) -> *const ffi::c_void { - let value = value as *mut limbo_core::Value; + let value = value as *mut turso_core::Value; let value = &*value; match value { - limbo_core::Value::Blob(blob) => blob.as_ptr() as *const ffi::c_void, + turso_core::Value::Blob(blob) => blob.as_ptr() as *const ffi::c_void, _ => std::ptr::null(), } } #[no_mangle] pub unsafe extern "C" fn sqlite3_value_bytes(value: *mut ffi::c_void) -> ffi::c_int { - let value = value as *mut limbo_core::Value; + let value = value as *mut turso_core::Value; let value = &*value; match value { - limbo_core::Value::Blob(blob) => blob.len() as ffi::c_int, + turso_core::Value::Blob(blob) => blob.len() as ffi::c_int, _ => 0, } } @@ -661,7 +661,7 @@ pub unsafe extern "C" fn sqlite3_column_text( None => return std::ptr::null(), }; match row.get::<&Value>(idx as usize) { - Ok(limbo_core::Value::Text(text)) => text.as_str().as_ptr(), + Ok(turso_core::Value::Text(text)) => text.as_str().as_ptr(), _ => std::ptr::null(), } } diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 8e103cb56..a891145f2 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -17,7 +17,7 @@ path = "integration/mod.rs" [dependencies] anyhow.workspace = true env_logger = "0.10.1" -limbo_core = { path = "../core" } +turso_core = { path = "../core" } rusqlite = { version = "0.34", features = ["bundled"] } tempfile = "3.0.7" log = "0.4.22" diff --git a/tests/integration/common.rs b/tests/integration/common.rs index 6b5947d99..6746092f3 100644 --- a/tests/integration/common.rs +++ b/tests/integration/common.rs @@ -1,4 +1,3 @@ -use limbo_core::{Connection, Database, PagerCacheflushStatus, IO}; use rand::{rng, RngCore}; use rusqlite::params; use std::path::{Path, PathBuf}; @@ -7,6 +6,7 @@ use tempfile::TempDir; use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::util::SubscriberInitExt; use tracing_subscriber::EnvFilter; +use turso_core::{Connection, Database, PagerCacheflushStatus, IO}; #[allow(dead_code)] pub struct TempDatabase { @@ -25,11 +25,11 @@ impl TempDatabase { pub fn new(db_name: &str, enable_indexes: bool) -> Self { let mut path = TempDir::new().unwrap().keep(); path.push(db_name); - let io: Arc = Arc::new(limbo_core::PlatformIO::new().unwrap()); + let io: Arc = Arc::new(turso_core::PlatformIO::new().unwrap()); let db = Database::open_file_with_flags( io.clone(), path.to_str().unwrap(), - limbo_core::OpenFlags::default(), + turso_core::OpenFlags::default(), false, enable_indexes, ) @@ -40,17 +40,17 @@ impl TempDatabase { pub fn new_with_existent(db_path: &Path, enable_indexes: bool) -> Self { Self::new_with_existent_with_flags( db_path, - limbo_core::OpenFlags::default(), + turso_core::OpenFlags::default(), enable_indexes, ) } pub fn new_with_existent_with_flags( db_path: &Path, - flags: limbo_core::OpenFlags, + flags: turso_core::OpenFlags, enable_indexes: bool, ) -> Self { - let io: Arc = Arc::new(limbo_core::PlatformIO::new().unwrap()); + let io: Arc = Arc::new(turso_core::PlatformIO::new().unwrap()); let db = Database::open_file_with_flags( io.clone(), db_path.to_str().unwrap(), @@ -79,11 +79,11 @@ impl TempDatabase { .unwrap(); connection.execute(table_sql, ()).unwrap(); } - let io: Arc = Arc::new(limbo_core::PlatformIO::new().unwrap()); + let io: Arc = Arc::new(turso_core::PlatformIO::new().unwrap()); let db = Database::open_file_with_flags( io.clone(), path.to_str().unwrap(), - limbo_core::OpenFlags::default(), + turso_core::OpenFlags::default(), false, enable_indexes, ) @@ -92,7 +92,7 @@ impl TempDatabase { Self { path, io, db } } - pub fn connect_limbo(&self) -> Arc { + pub fn connect_limbo(&self) -> Arc { log::debug!("conneting to limbo"); let conn = self.db.connect().unwrap(); @@ -100,7 +100,7 @@ impl TempDatabase { conn } - pub fn limbo_database(&self, enable_indexes: bool) -> Arc { + pub fn limbo_database(&self, enable_indexes: bool) -> Arc { log::debug!("conneting to limbo"); Database::open_file( self.io.clone(), @@ -184,7 +184,7 @@ pub(crate) fn sqlite_exec_rows( pub(crate) fn limbo_exec_rows( db: &TempDatabase, - conn: &Arc, + conn: &Arc, query: &str, ) -> Vec> { let mut stmt = conn.prepare(query).unwrap(); @@ -193,26 +193,26 @@ pub(crate) fn limbo_exec_rows( let row = loop { let result = stmt.step().unwrap(); match result { - limbo_core::StepResult::Row => { + turso_core::StepResult::Row => { let row = stmt.row().unwrap(); break row; } - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { db.io.run_once().unwrap(); continue; } - limbo_core::StepResult::Done => break 'outer, + turso_core::StepResult::Done => break 'outer, r => panic!("unexpected result {:?}: expecting single row", r), } }; let row = row .get_values() .map(|x| match x { - limbo_core::Value::Null => rusqlite::types::Value::Null, - limbo_core::Value::Integer(x) => rusqlite::types::Value::Integer(*x), - limbo_core::Value::Float(x) => rusqlite::types::Value::Real(*x), - limbo_core::Value::Text(x) => rusqlite::types::Value::Text(x.as_str().to_string()), - limbo_core::Value::Blob(x) => rusqlite::types::Value::Blob(x.to_vec()), + turso_core::Value::Null => rusqlite::types::Value::Null, + turso_core::Value::Integer(x) => rusqlite::types::Value::Integer(*x), + turso_core::Value::Float(x) => rusqlite::types::Value::Real(*x), + turso_core::Value::Text(x) => rusqlite::types::Value::Text(x.as_str().to_string()), + turso_core::Value::Blob(x) => rusqlite::types::Value::Blob(x.to_vec()), }) .collect(); rows.push(row); @@ -222,18 +222,18 @@ pub(crate) fn limbo_exec_rows( pub(crate) fn limbo_exec_rows_error( db: &TempDatabase, - conn: &Arc, + conn: &Arc, query: &str, -) -> limbo_core::Result<()> { +) -> turso_core::Result<()> { let mut stmt = conn.prepare(query)?; loop { let result = stmt.step()?; match result { - limbo_core::StepResult::IO => { + turso_core::StepResult::IO => { db.io.run_once()?; continue; } - limbo_core::StepResult::Done => return Ok(()), + turso_core::StepResult::Done => return Ok(()), r => panic!("unexpected result {:?}: expecting single row", r), } } @@ -292,7 +292,7 @@ mod tests { { let db = TempDatabase::new_with_existent_with_flags( &path, - limbo_core::OpenFlags::default(), + turso_core::OpenFlags::default(), false, ); let conn = db.connect_limbo(); @@ -305,7 +305,7 @@ mod tests { { let db = TempDatabase::new_with_existent_with_flags( &path, - limbo_core::OpenFlags::default() | limbo_core::OpenFlags::ReadOnly, + turso_core::OpenFlags::default() | turso_core::OpenFlags::ReadOnly, false, ); let conn = db.connect_limbo(); @@ -313,7 +313,7 @@ mod tests { assert_eq!(ret, vec![vec![Value::Integer(1)]]); let err = limbo_exec_rows_error(&db, &conn, "INSERT INTO t values (1)").unwrap_err(); - assert!(matches!(err, limbo_core::LimboError::ReadOnly), "{:?}", err); + assert!(matches!(err, turso_core::LimboError::ReadOnly), "{:?}", err); } Ok(()) } diff --git a/tests/integration/functions/test_function_rowid.rs b/tests/integration/functions/test_function_rowid.rs index 39c7334c8..b3e5f18e3 100644 --- a/tests/integration/functions/test_function_rowid.rs +++ b/tests/integration/functions/test_function_rowid.rs @@ -1,5 +1,5 @@ use crate::common::{do_flush, TempDatabase}; -use limbo_core::StepResult; +use turso_core::StepResult; #[test] fn test_last_insert_rowid_basic() -> anyhow::Result<()> { @@ -31,7 +31,7 @@ fn test_last_insert_rowid_basic() -> anyhow::Result<()> { match rows.step()? { StepResult::Row => { let row = rows.row().unwrap(); - if let limbo_core::Value::Integer(id) = row.get_value(0) { + if let turso_core::Value::Integer(id) = row.get_value(0) { assert_eq!(*id, 1, "First insert should have rowid 1"); } } @@ -67,7 +67,7 @@ fn test_last_insert_rowid_basic() -> anyhow::Result<()> { match rows.step()? { StepResult::Row => { let row = rows.row().unwrap(); - if let limbo_core::Value::Integer(id) = row.get_value(0) { + if let turso_core::Value::Integer(id) = row.get_value(0) { last_id = *id; } } @@ -113,7 +113,7 @@ fn test_integer_primary_key() -> anyhow::Result<()> { match select_query.step()? { StepResult::Row => { let row = select_query.row().unwrap(); - if let limbo_core::Value::Integer(id) = row.get_value(0) { + if let turso_core::Value::Integer(id) = row.get_value(0) { rowids.push(*id); } } diff --git a/tests/integration/query_processing/test_read_path.rs b/tests/integration/query_processing/test_read_path.rs index b0c394e97..418ec4ea2 100644 --- a/tests/integration/query_processing/test_read_path.rs +++ b/tests/integration/query_processing/test_read_path.rs @@ -1,5 +1,5 @@ use crate::common::TempDatabase; -use limbo_core::{StepResult, Value}; +use turso_core::{StepResult, Value}; #[test] fn test_statement_reset_bind() -> anyhow::Result<()> { @@ -16,7 +16,7 @@ fn test_statement_reset_bind() -> anyhow::Result<()> { let row = stmt.row().unwrap(); assert_eq!( *row.get::<&Value>(0).unwrap(), - limbo_core::Value::Integer(1) + turso_core::Value::Integer(1) ); } StepResult::IO => tmp_db.io.run_once()?, @@ -34,7 +34,7 @@ fn test_statement_reset_bind() -> anyhow::Result<()> { let row = stmt.row().unwrap(); assert_eq!( *row.get::<&Value>(0).unwrap(), - limbo_core::Value::Integer(2) + turso_core::Value::Integer(2) ); } StepResult::IO => tmp_db.io.run_once()?, @@ -67,23 +67,23 @@ fn test_statement_bind() -> anyhow::Result<()> { match stmt.step()? { StepResult::Row => { let row = stmt.row().unwrap(); - if let limbo_core::Value::Text(s) = row.get::<&Value>(0).unwrap() { + if let turso_core::Value::Text(s) = row.get::<&Value>(0).unwrap() { assert_eq!(s.as_str(), "hello") } - if let limbo_core::Value::Text(s) = row.get::<&Value>(1).unwrap() { + if let turso_core::Value::Text(s) = row.get::<&Value>(1).unwrap() { assert_eq!(s.as_str(), "hello") } - if let limbo_core::Value::Integer(i) = row.get::<&Value>(2).unwrap() { + if let turso_core::Value::Integer(i) = row.get::<&Value>(2).unwrap() { assert_eq!(*i, 42) } - if let limbo_core::Value::Blob(v) = row.get::<&Value>(3).unwrap() { + if let turso_core::Value::Blob(v) = row.get::<&Value>(3).unwrap() { assert_eq!(v.as_slice(), &vec![0x1_u8, 0x2, 0x3]) } - if let limbo_core::Value::Float(f) = row.get::<&Value>(4).unwrap() { + if let turso_core::Value::Float(f) = row.get::<&Value>(4).unwrap() { assert_eq!(*f, 0.5) } } diff --git a/tests/integration/query_processing/test_write_path.rs b/tests/integration/query_processing/test_write_path.rs index 9590b26d9..86452c06e 100644 --- a/tests/integration/query_processing/test_write_path.rs +++ b/tests/integration/query_processing/test_write_path.rs @@ -1,8 +1,8 @@ use crate::common::{self, maybe_setup_tracing}; use crate::common::{compare_string, do_flush, TempDatabase}; -use limbo_core::{Connection, Row, Statement, StepResult, Value}; use log::debug; use std::sync::Arc; +use turso_core::{Connection, Row, Statement, StepResult, Value}; #[macro_export] macro_rules! change_state { @@ -175,8 +175,8 @@ fn test_sequential_write() -> anyhow::Result<()> { run_query_on_row(&tmp_db, &conn, list_query, |row: &Row| { let first_value = row.get::<&Value>(0).expect("missing id"); let id = match first_value { - limbo_core::Value::Integer(i) => *i as i32, - limbo_core::Value::Float(f) => *f as i32, + turso_core::Value::Integer(i) => *i as i32, + turso_core::Value::Float(f) => *f as i32, _ => unreachable!(), }; assert_eq!(current_read_index, id); @@ -239,7 +239,7 @@ fn test_statement_reset() -> anyhow::Result<()> { let row = stmt.row().unwrap(); assert_eq!( *row.get::<&Value>(0).unwrap(), - limbo_core::Value::Integer(1) + turso_core::Value::Integer(1) ); break; } @@ -256,7 +256,7 @@ fn test_statement_reset() -> anyhow::Result<()> { let row = stmt.row().unwrap(); assert_eq!( *row.get::<&Value>(0).unwrap(), - limbo_core::Value::Integer(1) + turso_core::Value::Integer(1) ); break; } @@ -381,8 +381,8 @@ fn test_write_delete_with_index() -> anyhow::Result<()> { run_query_on_row(&tmp_db, &conn, list_query, |row: &Row| { let first_value = row.get::<&Value>(0).expect("missing id"); let id = match first_value { - limbo_core::Value::Integer(i) => *i as i32, - limbo_core::Value::Float(f) => *f as i32, + turso_core::Value::Integer(i) => *i as i32, + turso_core::Value::Float(f) => *f as i32, _ => unreachable!(), }; assert_eq!(current_read_index, id); @@ -397,8 +397,8 @@ fn test_write_delete_with_index() -> anyhow::Result<()> { |row| { let first_value = row.get::<&Value>(0).expect("missing id"); let id = match first_value { - limbo_core::Value::Integer(i) => *i as i32, - limbo_core::Value::Float(f) => *f as i32, + turso_core::Value::Integer(i) => *i as i32, + turso_core::Value::Float(f) => *f as i32, _ => unreachable!(), }; assert_eq!(i, id); diff --git a/tests/integration/wal/test_wal.rs b/tests/integration/wal/test_wal.rs index f2346f856..6fd42fda4 100644 --- a/tests/integration/wal/test_wal.rs +++ b/tests/integration/wal/test_wal.rs @@ -1,9 +1,9 @@ use crate::common::{do_flush, maybe_setup_tracing, TempDatabase}; -use limbo_core::{Connection, LimboError, Result, StepResult}; use std::cell::RefCell; use std::ops::Deref; use std::rc::Rc; use std::sync::{Arc, Mutex}; +use turso_core::{Connection, LimboError, Result, StepResult}; #[allow(clippy::arc_with_non_send_sync)] #[test] @@ -154,7 +154,7 @@ pub(crate) fn execute_and_get_ints( let row = stmt.row().unwrap(); for value in row.get_values() { let out = match value { - limbo_core::Value::Integer(i) => i, + turso_core::Value::Integer(i) => i, _ => { return Err(LimboError::ConversionError(format!( "cannot convert {value} to int" diff --git a/vendored/sqlite3-parser/src/to_sql_string/stmt/mod.rs b/vendored/sqlite3-parser/src/to_sql_string/stmt/mod.rs index 6692ae5f1..267e97ec0 100644 --- a/vendored/sqlite3-parser/src/to_sql_string/stmt/mod.rs +++ b/vendored/sqlite3-parser/src/to_sql_string/stmt/mod.rs @@ -244,7 +244,7 @@ mod tests { pub(crate) struct TestContext; // Placeholders for compilation - // Context only necessary parsing inside limbo_core or in the simulator + // Context only necessary parsing inside turso_core or in the simulator impl ToSqlContext for TestContext { fn get_column_name(&self, _table_id: crate::ast::TableInternalId, _col_idx: usize) -> &str { todo!()