Skip to content

Commit 03407c6

Browse files
authored
Merge branch 'main' into feat-add-list-namespaces-admin-endpoint
2 parents de45de8 + df497ca commit 03407c6

7 files changed

Lines changed: 58 additions & 34 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ exclude = [
2525
]
2626

2727
[workspace.package]
28-
version = "0.9.12"
28+
version = "0.9.14"
2929
authors = ["the libSQL authors"]
3030
edition = "2021"
3131
license = "MIT"
3232
repository = "https://github.com/tursodatabase/libsql"
3333

3434
[workspace.dependencies]
35-
libsql-ffi = { path = "libsql-ffi", version = "0.9.12" }
36-
libsql-sys = { path = "libsql-sys", version = "0.9.12", default-features = false }
37-
libsql-hrana = { path = "libsql-hrana", version = "0.9.12" }
38-
libsql_replication = { path = "libsql-replication", version = "0.9.12" }
39-
rusqlite = { package = "libsql-rusqlite", path = "vendored/rusqlite", version = "0.9.12", default-features = false, features = [
35+
libsql-ffi = { path = "libsql-ffi", version = "0.9.14" }
36+
libsql-sys = { path = "libsql-sys", version = "0.9.14", default-features = false }
37+
libsql-hrana = { path = "libsql-hrana", version = "0.9.14" }
38+
libsql_replication = { path = "libsql-replication", version = "0.9.14" }
39+
rusqlite = { package = "libsql-rusqlite", path = "vendored/rusqlite", version = "0.9.14", default-features = false, features = [
4040
"libsql-experimental",
4141
"column_decltype",
4242
"load_extension",

libsql/examples/encryption_sync.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ async fn main() {
2525
None
2626
};
2727

28-
let db_builder =
29-
Builder::new_synced_database(db_path, sync_url, auth_token).remote_encryption(encryption);
28+
let mut db_builder = Builder::new_synced_database(db_path, sync_url, auth_token);
29+
30+
if let Some(enc) = encryption {
31+
db_builder = db_builder.remote_encryption(enc);
32+
}
3033

3134
let db = match db_builder.build().await {
3235
Ok(db) => db,

libsql/src/connection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl Connection {
137137
///
138138
/// # Return
139139
///
140-
/// This returns a `BatchRows` currently only the `remote` and `local` connection supports this feature and
140+
/// This returns a `BatchRows` currently only the `remote` and `local` connection supports this feature and
141141
/// all other connection types will return an empty set always.
142142
pub async fn execute_batch(&self, sql: &str) -> Result<BatchRows> {
143143
tracing::trace!("executing batch `{}`", sql);
@@ -206,7 +206,7 @@ impl Connection {
206206
self.conn.busy_timeout(timeout)
207207
}
208208

209-
/// Check weather libsql is in `autocommit` or not.
209+
/// Check whether libsql is in `autocommit` or not.
210210
pub fn is_autocommit(&self) -> bool {
211211
self.conn.is_autocommit()
212212
}

libsql/src/database/builder.rs

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub use crate::database::EncryptionContext;
2525
///
2626
/// # Note
2727
///
28-
/// Embedded replica's require a clean database (no database file) or a previously synced database or else it will
28+
/// Embedded replicas require a clean database (no database file) or a previously synced database or else it will
2929
/// throw an error to prevent any misuse. To work around this error a user can delete the database
3030
/// and let it resync and create the wal_index metadata file.
3131
pub struct Builder<T = ()> {
@@ -276,7 +276,7 @@ cfg_replication! {
276276
self
277277
}
278278

279-
/// Set weather you want writes to be visible locally before the write query returns. This
279+
/// Set whether you want writes to be visible locally before the write query returns. This
280280
/// means that you will be able to read your own writes if this is set to `true`.
281281
///
282282
/// # Default
@@ -306,8 +306,8 @@ cfg_replication! {
306306

307307
/// Set the encryption context if the database is encrypted in remote server.
308308
#[cfg(feature = "sync")]
309-
pub fn remote_encryption(mut self, encryption_context: Option<EncryptionContext>) -> Builder<RemoteReplica> {
310-
self.inner.remote_encryption = encryption_context;
309+
pub fn remote_encryption(mut self, encryption_context: EncryptionContext) -> Builder<RemoteReplica> {
310+
self.inner.remote_encryption = Some(encryption_context);
311311
self
312312
}
313313

@@ -333,7 +333,7 @@ cfg_replication! {
333333
self
334334
}
335335

336-
/// Skip the saftey assert used to ensure that sqlite3 is configured correctly for the way
336+
/// Skip the safety assert used to ensure that sqlite3 is configured correctly for the way
337337
/// that libsql uses the ffi code. By default, libsql will try to use the SERIALIZED
338338
/// threadsafe mode for sqlite3. This allows us to implement Send/Sync for all the types to
339339
/// allow them to move between threads safely. Due to the fact that sqlite3 has a global
@@ -399,9 +399,14 @@ cfg_replication! {
399399
url.to_string()
400400
};
401401
let req = http::Request::get(format!("{prefix}/info"))
402-
.header("Authorization", format!("Bearer {}", auth_token))
403-
.body(hyper::Body::empty())
404-
.unwrap();
402+
.header("Authorization", format!("Bearer {}", auth_token));
403+
404+
let req = if let Some(ref remote_encryption) = remote_encryption {
405+
req.header("x-turso-encryption-key", remote_encryption.key.as_string())
406+
} else {
407+
req
408+
};
409+
let req = req.body(hyper::Body::empty()).unwrap();
405410

406411
let res = client
407412
.request(req)
@@ -427,11 +432,14 @@ cfg_replication! {
427432

428433
if res.status().is_success() {
429434
tracing::trace!("Using sync protocol v2 for {}", url);
430-
let builder = Builder::new_synced_database(path, url, auth_token)
435+
let mut builder = Builder::new_synced_database(path, url, auth_token)
431436
.connector(connector)
432437
.remote_writes(true)
433-
.read_your_writes(read_your_writes)
434-
.remote_encryption(remote_encryption);
438+
.read_your_writes(read_your_writes);
439+
440+
if let Some(encryption) = remote_encryption {
441+
builder = builder.remote_encryption(encryption);
442+
}
435443

436444
let builder = if let Some(sync_interval) = sync_interval {
437445
builder.sync_interval(sync_interval)
@@ -616,8 +624,8 @@ cfg_sync! {
616624
}
617625

618626
/// Set the encryption context if the database is encrypted in remote server.
619-
pub fn remote_encryption(mut self, encryption_context: Option<EncryptionContext>) -> Builder<SyncedDatabase> {
620-
self.inner.remote_encryption = encryption_context;
627+
pub fn remote_encryption(mut self, encryption_context: EncryptionContext) -> Builder<SyncedDatabase> {
628+
self.inner.remote_encryption = Some(encryption_context);
621629
self
622630
}
623631

@@ -784,8 +792,8 @@ cfg_remote! {
784792
}
785793

786794
/// Set the encryption context if the database is encrypted in remote server.
787-
pub fn remote_encryption(mut self, encryption_context: Option<EncryptionContext>) -> Builder<Remote> {
788-
self.inner.remote_encryption = encryption_context;
795+
pub fn remote_encryption(mut self, encryption_context: EncryptionContext) -> Builder<Remote> {
796+
self.inner.remote_encryption = Some(encryption_context);
789797
self
790798
}
791799

vendored/rusqlite/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "libsql-rusqlite"
33
# Note: Update version in README.md when you change this.
4-
version = "0.9.12"
4+
version = "0.9.14"
55
authors = ["The rusqlite developers"]
66
edition = "2018"
77
description = "Ergonomic wrapper for SQLite (libsql fork)"

xtask/src/main.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ fn build_wasm(_arg: &str) -> Result<()> {
7676

7777
fn run_tests(arg: &str) -> Result<()> {
7878
println!("installing nextest");
79-
run_cargo(&["install", "cargo-nextest"])?;
79+
run_cargo(&[
80+
"install",
81+
"--locked",
82+
"--version",
83+
"0.9.98",
84+
"cargo-nextest",
85+
])?;
8086
println!("running nextest run");
8187
run_cargo(&["nextest", "run", arg])?;
8288

@@ -85,7 +91,14 @@ fn run_tests(arg: &str) -> Result<()> {
8591

8692
fn run_tests_encryption(arg: &str) -> Result<()> {
8793
println!("installing nextest");
88-
run_cargo(&["install", "--force", "cargo-nextest"])?;
94+
run_cargo(&[
95+
"install",
96+
"--force",
97+
"--locked",
98+
"--version",
99+
"0.9.98",
100+
"cargo-nextest",
101+
])?;
89102
println!("running nextest run");
90103
run_cargo(&[
91104
"nextest",

0 commit comments

Comments
 (0)