Skip to content

Commit 1b5c957

Browse files
committed
Move SQLite orchestration into trailbase-sqlite and fix js-runtime completion bug with true async (previously libsql was sync under the hood).
1 parent 3b9a122 commit 1b5c957

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1527
-458
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
[submodule "vendor/sqlean/bundled/sqlean"]
88
path = vendor/sqlean/bundled/sqlean
99
url = https://github.com/trailbaseio/sqlean
10-
[submodule "vendor/tokio-rusqlite"]
11-
path = vendor/tokio-rusqlite
12-
url = https://github.com/trailbaseio/tokio-rusqlite.git
1310
[submodule "vendor/serde_rusqlite"]
1411
path = vendor/serde_rusqlite
1512
url = https://github.com/trailbaseio/serde_rusqlite.git

Cargo.lock

Lines changed: 4 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ members = [
77
"trailbase-extension",
88
"trailbase-sqlite",
99
"vendor/sqlean",
10-
"vendor/tokio-rusqlite",
1110
]
1211
default-members = [
1312
"trailbase-cli",
@@ -41,6 +40,4 @@ rusqlite = { version = "^0.32.1", default-features = false, features = [
4140
"limits",
4241
"backup",
4342
] }
44-
serde_rusqlite = { package = "serde_rusqlite", path = "./vendor/serde_rusqlite" }
4543
sqlite-loadable = { package = "sqlite-loadable", path = "./vendor/sqlite-loadable", features=["static"] }
46-
tokio-rusqlite = { package = "tokio-rusqlite", path = "./vendor/tokio-rusqlite" }

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
default: format check
22

3-
target/x86_64-unknown-linux-gnu/release/trail:
3+
static:
44
RUSTFLAGS="-C target-feature=+crt-static" cargo build --target x86_64-unknown-linux-gnu --release --bin trail
55

66
format:
@@ -21,4 +21,4 @@ check:
2121
docker:
2222
docker build . -t trailbase/trailbase
2323

24-
.PHONY: default format check
24+
.PHONY: default format check static

docs/src/content/docs/reference/_benchmarks/benchmarks.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export function Duration100kInsertsChartMoreResults() {
148148

149149
export function PocketBaseAndTrailBaseReadLatencies() {
150150
// 2024-10-12
151-
// Read 1000000 messages, took 0:00:57.952120 (limit=64)
151+
// TB: Read 1 000 000 messages, took 0:00:57.952120 (limit=64)
152152
const readTrailbaseMicroS = {
153153
p50: 3504,
154154
p75: 3947,
@@ -157,7 +157,7 @@ export function PocketBaseAndTrailBaseReadLatencies() {
157157
};
158158

159159
// 2024-10-12
160-
// Read 100000 messages, took 0:00:20.273054 (limit=64)
160+
// PB: Read 100 000 messages, took 0:00:20.273054 (limit=64)
161161
const readPocketbaseMicroS = {
162162
p50: 12740,
163163
p75: 13718,

examples/coffeesearch/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
all: init app
1+
build_n_data: build data_init
22

3-
app: dist
4-
pnpm build
3+
build: dist
4+
rm -rf dist && pnpm build
55

6-
init:
6+
data_init:
77
rm -rf traildepot/data && mkdir -p traildepot/data && cat import.sql | sqlite3 traildepot/data/main.db -
88

9+
run:
10+
cargo run -- run --public-dir dist
11+
912
.PHONY: init

trailbase-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ chrono = "^0.4.38"
1616
clap = { version = "^4.4.11", features=["derive", "env"] }
1717
env_logger = "^0.11.3"
1818
trailbase-core = { path = "../trailbase-core" }
19+
trailbase-sqlite = { path = "../trailbase-sqlite" }
1920
log = "^0.4.21"
2021
mimalloc = { version = "^0.1.41", default-features = false }
2122
serde = { version = "^1.0.203", features = ["derive"] }
2223
serde_json = "^1.0.117"
2324
tokio = { version = "^1.38.0", features=["macros", "rt-multi-thread", "fs", "signal"] }
24-
tokio-rusqlite = { workspace = true }
2525
tracing-subscriber = "0.3.18"
2626
utoipa = { version = "5.0.0-beta.0", features = ["axum_extras"], optional = true }
2727
utoipa-swagger-ui = { version = "8.0.1", features = ["axum"], optional = true }

trailbase-cli/src/bin/trail.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl DbUser {
5454
}
5555

5656
async fn get_user_by_email(
57-
conn: &tokio_rusqlite::Connection,
57+
conn: &trailbase_sqlite::Connection,
5858
email: &str,
5959
) -> Result<DbUser, BoxError> {
6060
if let Some(user) = conn
@@ -158,7 +158,7 @@ async fn async_main() -> Result<(), BoxError> {
158158
Some(SubCommands::Schema(cmd)) => {
159159
init_logger(false);
160160

161-
let conn = tokio_rusqlite::Connection::from_conn(api::connect_sqlite(
161+
let conn = trailbase_sqlite::Connection::from_conn(api::connect_sqlite(
162162
Some(data_dir.main_db_path()),
163163
None,
164164
)?)
@@ -202,7 +202,7 @@ async fn async_main() -> Result<(), BoxError> {
202202
Some(SubCommands::Admin { cmd }) => {
203203
init_logger(false);
204204

205-
let conn = tokio_rusqlite::Connection::from_conn(api::connect_sqlite(
205+
let conn = trailbase_sqlite::Connection::from_conn(api::connect_sqlite(
206206
Some(data_dir.main_db_path()),
207207
None,
208208
)?)
@@ -257,7 +257,7 @@ async fn async_main() -> Result<(), BoxError> {
257257
init_logger(false);
258258

259259
let data_dir = DataDir(args.data_dir);
260-
let conn = tokio_rusqlite::Connection::from_conn(api::connect_sqlite(
260+
let conn = trailbase_sqlite::Connection::from_conn(api::connect_sqlite(
261261
Some(data_dir.main_db_path()),
262262
None,
263263
)?)

trailbase-core/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ sqlite3-parser = "0.13.0"
6060
thiserror = "2.0.1"
6161
thread_local = "1.1.8"
6262
tokio = { version = "^1.38.0", features=["macros", "rt-multi-thread", "fs", "signal", "time"] }
63-
tokio-rusqlite = { workspace = true }
6463
tower-cookies = { version = "0.10.0" }
6564
tower-http = { version = "^0.6.0", features=["cors", "trace", "fs", "limit"] }
6665
tower-service = "0.3.3"

trailbase-core/src/admin/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use thiserror::Error;
77
#[derive(Debug, Error)]
88
pub enum AdminError {
99
#[error("TokioRusqlite error: {0}")]
10-
TokioRusqlite(#[from] tokio_rusqlite::Error),
10+
TokioRusqlite(#[from] trailbase_sqlite::Error),
1111
#[error("Rusqlite error: {0}")]
1212
Rusqlite(#[from] rusqlite::Error),
1313
#[error("Rusqlite FromSql error: {0}")]

0 commit comments

Comments
 (0)