Skip to content

Commit

Permalink
Merge pull request #128 from tursodatabase/fix_110
Browse files Browse the repository at this point in the history
Allow read your writes configuration
  • Loading branch information
penberg authored Aug 6, 2024
2 parents e21804d + 76931a4 commit 35baa1d
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 78 deletions.
17 changes: 8 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib"]

[dependencies]
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
libsql = { git = "https://github.com/tursodatabase/libsql/", rev = "8a8a897833ec98a6201d22d5c5cf803cd57f98c6", features = ["encryption"] }
libsql = { git = "https://github.com/tursodatabase/libsql", features = ["encryption"] }
tracing = "0.1"
once_cell = "1.18.0"
tokio = { version = "1.29.1", features = [ "rt-multi-thread" ] }
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class Database {
}
const encryptionKey = opts?.encryptionKey ?? "";
const syncPeriod = opts?.syncPeriod ?? 0.0;
this.db = databaseOpenWithRpcSync(path, opts.syncUrl, authToken, encryptionCipher, encryptionKey, syncPeriod);
const readYourWrites = opts?.readYourWrites ?? true;
this.db = databaseOpenWithRpcSync(path, opts.syncUrl, authToken, encryptionCipher, encryptionKey, syncPeriod, readYourWrites);
} else {
const authToken = opts?.authToken ?? "";
const encryptionKey = opts?.encryptionKey ?? "";
Expand Down
132 changes: 67 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
"dependencies": {
"@neon-rs/load": "^0.0.4",
"detect-libc": "2.0.2",
"libsql": "^0.3.15"
"libsql": "^0.3.19"
}
}
3 changes: 2 additions & 1 deletion src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl Database {
let encryption_cipher = cx.argument::<JsString>(3)?.value(&mut cx);
let encryption_key = cx.argument::<JsString>(4)?.value(&mut cx);
let sync_period = cx.argument::<JsNumber>(5)?.value(&mut cx);
let read_your_writes = cx.argument::<JsBoolean>(6)?.value(&mut cx);

let cipher = libsql::Cipher::from_str(&encryption_cipher).or_else(|err| {
throw_libsql_error(
Expand Down Expand Up @@ -98,7 +99,7 @@ impl Database {
sync_url,
sync_auth,
Some(version),
true,
read_your_writes,
encryption_config,
sync_period,
);
Expand Down

0 comments on commit 35baa1d

Please sign in to comment.