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(unstable): append commit versionstamp to key #21556

Merged
merged 2 commits into from
Dec 13, 2023

Conversation

losfair
Copy link
Member

@losfair losfair commented Dec 13, 2023

const kv = await Deno.openKv();
const { versionstamp } = await kv.set(["logs", kv.commitVersionstamp()], "a");
const { value } = await kv.get(["logs", versionstamp]); // value === "a"

Comment on lines +763 to +764
key.length && m[1] === "set" &&
key[key.length - 1] === commitVersionstampSymbol
Copy link

Choose a reason for hiding this comment

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

what if commitVersionstamp() is used as not the last part of the key? or if its used with operation other than "set"? seems like we should throw in that case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Native code checks for that as part of deserialization, and throws

Copy link
Member Author

Choose a reason for hiding this comment

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

Added to the test

@losfair losfair requested a review from igorzi December 13, 2023 15:59
@losfair losfair merged commit 10ab8c1 into denoland:main Dec 13, 2023
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.

None yet

3 participants