deno icon indicating copy to clipboard operation
deno copied to clipboard

Ability to control the backing storage of Deno.openKv

Open zbynekwinkler opened this issue 2 years ago • 2 comments

In order to be able to write tests using Deno Kv there should be a way to control the storage.

Using strace I was able to locate the actual backing file: ~/.cache/deno/location_data/d6f888b9dae5a9d23bf85990c7609f8e3471db775bdd3bdf64c55c695353991d/kv.sqlite3. This file is shared for all invocations of deno from inside the project. I'd like to be able to specify :memory: (for regular test runs) or some other file (for debugging) as a backing store.

I am not sure what the right knobs would be. Probably cmdline argument would work the best for me. That would allow using empty ephemeral store as well as some curated prepopulated store for regression tests.

zbynekwinkler avatar Jul 21 '23 12:07 zbynekwinkler

Sorry, I completely missed the argument to Deno.openKv (probably due to not being used in any of the examples). What happens when the argument is set to something while running on Deno Deploy? Is it ignored there?

zbynekwinkler avatar Jul 21 '23 13:07 zbynekwinkler

You can specify the endpoint that implements KV Connect protocol.

denokv is a program to self-host sqlite-backed KV connect endpoint.

kt3k avatar Jan 26 '24 06:01 kt3k