summaryrefslogtreecommitdiff
path: root/runtime/build.rs
diff options
context:
space:
mode:
authorHeyang Zhou <zhy20000919@hotmail.com>2023-03-22 12:13:24 +0800
committerGitHub <noreply@github.com>2023-03-22 12:13:24 +0800
commit92ebf4afe5d55135b3ba39616bcb77106c07c597 (patch)
treef79fe65811c7449f5b50c093852eceaad228d39f /runtime/build.rs
parent8bcffff9dc517aa93dea2816b2a854f65d24eccc (diff)
feat(ext/kv): key-value store (#18232)
This commit adds unstable "Deno.openKv()" API that allows to open a key-value database at a specified path. --------- Co-authored-by: Luca Casonato <hello@lcas.dev> Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'runtime/build.rs')
-rw-r--r--runtime/build.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/runtime/build.rs b/runtime/build.rs
index ec7c9642c..5d0ba0cc7 100644
--- a/runtime/build.rs
+++ b/runtime/build.rs
@@ -200,6 +200,24 @@ mod startup_snapshot {
}
}
+ impl deno_kv::sqlite::SqliteDbHandlerPermissions for Permissions {
+ fn check_read(
+ &mut self,
+ _path: &Path,
+ _api_name: &str,
+ ) -> Result<(), AnyError> {
+ unreachable!("snapshotting!")
+ }
+
+ fn check_write(
+ &mut self,
+ _path: &Path,
+ _api_name: &str,
+ ) -> Result<(), AnyError> {
+ unreachable!("snapshotting!")
+ }
+ }
+
deno_core::extension!(runtime,
deps = [
deno_webidl,
@@ -289,6 +307,10 @@ mod startup_snapshot {
None,
),
deno_tls::deno_tls::init_ops_and_esm(),
+ deno_kv::deno_kv::init_ops_and_esm(
+ deno_kv::sqlite::SqliteDbHandler::<Permissions>::new(None),
+ false, // No --unstable
+ ),
deno_napi::deno_napi::init_ops_and_esm::<Permissions>(),
deno_http::deno_http::init_ops_and_esm(),
deno_io::deno_io::init_ops_and_esm(Default::default()),