-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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): connect to remote database #20178
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any tests that could be added?
- SQLite - backed by a local SQLite database. This backend is suitable for | ||
development and is the default when running locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI people have been asking about alternative local backends: #18975 can this be addressed somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a note on additional backends
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add instructions on how to install protobuf for linux, windows, and osx as this will be a new requirement for those running "cargo install" or building. These should be in:
- cli/README,
- https://github.com/denoland/deno_install, and
- manual
b54c2b1
to
7793e7c
Compare
Added a test with a mock remote target in |
Added notes on protobuf compiler to related docs: |
test_util/src/lib.rs
Outdated
@@ -72,6 +80,9 @@ const PORT: u16 = 4545; | |||
const TEST_AUTH_TOKEN: &str = "abcdef123456789"; | |||
const TEST_BASIC_AUTH_USERNAME: &str = "testuser123"; | |||
const TEST_BASIC_AUTH_PASSWORD: &str = "testpassabc"; | |||
const KV_DATABASE_ID: &str = "55bd5c48-58c2-4eb4-8adb-995c0763622a"; | |||
const KV_ACCESS_TOKEN: &str = "578528e20364923229b08f94386b236f"; | |||
const KV_DATABASE_TOKEN: &str = "iFOw5tcudKE2Cy4MKNuWZjxGkg4"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume these are just mock values not real tokens? Can you make them more obviously such - for example:
const KV_DATABASE_ID: &str = "11111111-1111-1111-1111-111111111111";
const KV_ACCESS_TOKEN: &str = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
const KV_DATABASE_TOKEN: &str = "MOCKMOCKMOCKMOCKMOCKMOCKMOCK";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test where the first endpoint returns the wrong JSON, and one where it returns the right structure but with a different protocol version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const db = await Deno.openKv( | ||
"http://localhost:4545/kv_remote_authorize_invalid_format", | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should try to get the metadata during Deno.openKv
and throw already in the open call if we can't authenticate / the metadata response is wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That slows down app startup - any user initialization logic after Deno.openKv
would have to wait for the first KV metadata response.
I prefer to keep that an asynchronous operation and defer any error to the first KV API call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
there is some remaining concerns about introducing protoc as a build dependency - so we might need to come back and check-in the generated code.
Just want to comment that this threw me for a loop when I pulled main and did a compile. I suspect a lot of folks used to building from source will scratch their head as the cargo build error don't give any hints as to how to correct it and I actually had to read through the PR to figure out what to do. Just has been years that On the other hand, this is an awesome cool feature! 👍 |
Maybe we should add a feature to switch the |
This patch adds a `remote` backend for `ext/kv`. This supports connection to Deno Deploy and potentially other services compatible with the KV Connect protocol.
This patch adds a
remote
backend forext/kv
. This supports connection to Deno Deploy and potentially other services compatible with the KV Connect protocol.