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

Non string keys #8

Open
olanod opened this issue Apr 8, 2023 · 5 comments
Open

Non string keys #8

olanod opened this issue Apr 8, 2023 · 5 comments

Comments

@olanod
Copy link

olanod commented Apr 8, 2023

There are many use-cases that would benefit from having a key-value store where keys are not strings but opaque bytes, would there be a particular reason why the type key needs to be string?

@Mossaka
Copy link
Collaborator

Mossaka commented Apr 12, 2023

I have experimented with a few keyvalue stores (dynamodb, redis, azure cosmos db) and they all seem to accept key as strings. Could you please list a few use cases where the keys are non-strings? I am happy to change the key type

@olanod
Copy link
Author

olanod commented Apr 15, 2023

I'd use it for embedded use cases for example, sometimes directly store the bytes or abstract it to use data structures that are encoded automatically to an efficient representation.

@sunfishcode
Copy link
Member

Another challenge with byte sequences is that it's not possible to transcode plain bytes to key-value stores which use different character encodings. It looks to me like string is a better fit for the use cases and implementations that originally motivated wasi-keyvalue.

@olanod
Copy link
Author

olanod commented Apr 21, 2023

What about supporting both with keys being something like an enum?

@sunfishcode
Copy link
Member

With an enum, using wasi-keyvalue with a backend that needs strings would have to always fail when given bytes.

Could you say more about your use case? What kinds of embedded programs would use an external key-value store? What backends would you expect to be used to implement the interface?

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

No branches or pull requests

3 participants