Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ext/kv): key-value store #18232

Merged
merged 33 commits into from
Mar 22, 2023
Merged

feat(ext/kv): key-value store #18232

merged 33 commits into from
Mar 22, 2023

Conversation

losfair
Copy link
Member

@losfair losfair commented Mar 16, 2023

This commit adds unstable "Deno.openKv()" API that allows to open
a key-value database at a specified path.

@CLAassistant
Copy link

CLAassistant commented Mar 16, 2023

CLA assistant check
All committers have signed the CLA.

losfair and others added 2 commits March 17, 2023 17:06
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking as "Request changes" because we're in the middle of refactor to ops in
#18080 and #18210.

Let's keep reviewing this PR, but I want to hold of until weekend with landing this one.

@lucacasonato
Copy link
Member

lucacasonato commented Mar 19, 2023

todo:

  • test key serialization from/to js (bigint panics right now)
  • move selector & cursor parsing logic to rust

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I read through the source and besides some nitpicks there's nothing standing out.

We can address these nitpicks after the release.

@losfair losfair merged commit 92ebf4a into denoland:main Mar 22, 2023
@jsejcksn
Copy link
Contributor

jsejcksn commented Mar 23, 2023

@losfair I see a Deno.Kv#getMany method in the types, but a corresponding method does not exist on an instance at runtime. Was the method a short-lived experiment or am I missing something?

example.ts:

/// <reference lib="deno.unstable" />

const db = await Deno.openKv(":memory:");

console.log(Object.getOwnPropertyNames(Object.getPrototypeOf(db)));

console.log(await db.getMany([]));

await db.close();
% deno --version
deno 1.32.0 (release, aarch64-apple-darwin)
v8 11.2.214.9
typescript 5.0.2

% deno check example.ts

% echo $?
0

% deno run --unstable example.ts
[
  "constructor",
  "atomic",
  "get",
  "set",
  "delete",
  "list",
  "close"
]
error: Uncaught TypeError: db.getMany is not a function
console.log(await db.getMany([]));
                     ^
    at file:///Users/deno/example.ts:7:22

@losfair
Copy link
Member Author

losfair commented Mar 24, 2023

@jsejcksn fixed in #18410

hardfist pushed a commit to hardfist/deno that referenced this pull request Aug 7, 2024
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants