Skip to content

Commit

Permalink
Allow read your writes configuration
Browse files Browse the repository at this point in the history
Fixes #110

Signed-off-by: Piotr Jastrzebski <[email protected]>
  • Loading branch information
haaawk committed Aug 5, 2024
1 parent e21804d commit bdaae17
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", branch = "libsql_js", 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 bdaae17

Please sign in to comment.