Skip to content

Commit b22e882

Browse files
Merge remote-tracking branch 'upstream/main'
2 parents 0103f03 + f17ada2 commit b22e882

File tree

36 files changed

+1106
-265
lines changed

36 files changed

+1106
-265
lines changed

Cargo.lock

Lines changed: 104 additions & 131 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.25"
28+
version = "0.9.29"
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.25" }
36-
libsql-sys = { path = "libsql-sys", version = "0.9.25", default-features = false }
37-
libsql-hrana = { path = "libsql-hrana", version = "0.9.25" }
38-
libsql_replication = { path = "libsql-replication", version = "0.9.25" }
39-
rusqlite = { package = "libsql-rusqlite", path = "vendored/rusqlite", version = "0.9.25", default-features = false, features = [
35+
libsql-ffi = { path = "libsql-ffi", version = "0.9.29" }
36+
libsql-sys = { path = "libsql-sys", version = "0.9.29", default-features = false }
37+
libsql-hrana = { path = "libsql-hrana", version = "0.9.29" }
38+
libsql_replication = { path = "libsql-replication", version = "0.9.29" }
39+
rusqlite = { package = "libsql-rusqlite", path = "vendored/rusqlite", version = "0.9.29", default-features = false, features = [
4040
"libsql-experimental",
4141
"column_decltype",
4242
"load_extension",

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333

3434
---
3535

36+
> [!NOTE]
37+
> This repository contains libSQL, a fork of SQLite developed by Turso. For the full SQLite rewriten in Rust (also by Turso), please visit [tursodatabase/turso](https://github.com/tursodatabase/turso).
38+
3639
## Documentation
3740

3841
We aim to evolve it to suit many more use cases than SQLite was originally designed for, and plan to use third-party OSS code wherever it makes sense.
@@ -69,6 +72,7 @@ The comprehensive description can be found [here](libsql-sqlite3/doc/libsql_exte
6972

7073
* [PHP](https://github.com/tursodatabase/turso-client-php)
7174
* [D](https://github.com/pdenapo/libsql-d) (experimental, based on the C driver)
75+
* [Ring](https://github.com/ysdragon/ring-libsql) (experimental, based on the C driver)
7276

7377
### GUI Support
7478

docs/ADMIN_API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The admin API is used to manage namespaces on a `sqld` instance. Namespaces are
66

77
To enable the admin API, and manage namespaces, two extra flags need to be passed to `sqld`:
88

9-
- `--admin-listen-addr <addr>:<port>`: the address and port on which the admin API should listen. It must be different from the user API listen address (whi defaults to port 8080).
9+
- `--admin-listen-addr <addr>:<port>`: the address and port on which the admin API should listen. It must be different from the user API listen address (which defaults to port 8080).
1010
- `--enable-namespaces`: enable namespaces for the instance. By default namespaces are disabled.
1111

1212
## Routes

docs/DOCKER.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ docker run --name some-sqld-replica -p 8081:8080 -ti \
1717
-e SQLD_NODE=replica \
1818
-e SQLD_PRIMARY_URL=https://<host>:<port> \
1919
ghcr.io/tursodatabase/libsql-server:latest
20-
````
20+
```
2121

2222
## Running on Apple Silicon
2323

@@ -122,7 +122,6 @@ inter-node communication. Recommended to leave this on default.
122122
Simple docker compose for local development:
123123

124124
```yaml
125-
version: "3"
126125
services:
127126
db:
128127
image: ghcr.io/tursodatabase/libsql-server:latest

docs/USER_GUIDE.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Welcome to the `sqld` user guide!
2525
The `sqld` program provides libsql over HTTP and supports transparent replication.
2626

2727
![libsql cluster overview.](sqld-overview.png)
28+
2829
<p align="center">
2930
Figure 1. Overview of libsql clustering.
3031
</p>
@@ -82,7 +83,7 @@ You now have a `sqld` primary server listening to SQL over HTTP at `127.0.0.1:80
8283

8384
### Launching a replica server
8485

85-
To start a a `sqld` server in replica mode, run:
86+
To start a `sqld` server in replica mode, run:
8687

8788
```console
8889
sqld \
@@ -150,7 +151,7 @@ curl -X POST -d '{"statements": ["select * from testme"]}' $YOUR_APP.fly.dev
150151
```
151152

152153
```json
153-
[{"b":2,"a":1,"c":3}]
154+
[{ "b": 2, "a": 1, "c": 3 }]
154155
```
155156

156157
## Incremental snapshots
@@ -182,7 +183,7 @@ and then configure `sqld` to generate an incremental snapshot every 5 seconds an
182183
sqld --snapshot-exec ./snapshot.sh --max-log-duration 5
183184
```
184185

185-
When you write to the `sqld` database, you will eventually see log line such as:
186+
When you write to the `sqld` database, you will eventually see a log line such as:
186187

187188
```console
188189
2023-08-11T08:21:04.183564Z INFO sqld::replication::snapshot: snapshot `e126f594-90f4-45be-9350-bc8a01160de9-0-2.snap` successfully created
@@ -254,7 +255,7 @@ For example, if you have the following entries in your `/etc/hosts` file:
254255
127.0.0.1 db2.local
255256
```
256257

257-
You can access `db1` with the `http://db1.local:8080`URL and `db2` with `http://db2.local:8080`.
258+
You can access `db1` with the `http://db1.local:8080` URL and `db2` with `http://db2.local:8080`.
258259
The database files for the databases are stored in `<data dir>/dbs/db1` and `<data dir/dbs/db2`, respectively.
259260

260261
### Path based routing

libsql-ffi/bundled/SQLite3MultipleCiphers/src/codecext.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
** License: MIT
88
*/
99

10+
/*
11+
** Forward declaration for db codec check function.
12+
** Used to update cached codec status after encryption changes.
13+
*/
14+
int libsql_db_has_codec(sqlite3_vfs* pVfs, const char* zFilename);
15+
1016
/*
1117
** "Special" version of function sqlite3BtreeSetPageSize
1218
** This version allows to reduce the number of reserved bytes per page,
@@ -585,6 +591,8 @@ sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey)
585591
{
586592
sqlite3mcSetIsEncrypted(codec, 0);
587593
}
594+
/* Update both pager and database cached codec status after changing encryption */
595+
db->aDb[dbIndex].hasCodec = pPager->hasCodec = libsql_db_has_codec(pPager->pVfs, pPager->zFilename);
588596
}
589597
else
590598
{

0 commit comments

Comments
 (0)