WebAssembly / WebAssembly/wasi-keyvalue
`list-keys` cursor should be a resource
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 54
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
In the current spec the bucket.list-keys operation and associated key-response struct gives a cursor: option<string> as a mechanism for implementing pagination. This introduces several problems for implementors:
- How long does the implementation have to keep a continuation around for future pagination? This could potentially be very costly in terms of memory and may create consistency issues.
- What happens if the implementation is given a cursor that it doesn't recognize?
- What sort of information does the implementation put into the cursor string? How are we sure that implementations won't do something improper with that information, e.g. parse it for hints or otherwise rely on its contents, creating a portability problem?
All of these problems are solved by changing from an option<string> to, instead, defining a new resource cursor { next: func() -> result<key-response, cursor-error> }, changing key-response to contain an option<cursor>, and eliminating the cursor: option<string> argument from list-keys:
- The implementation keeps track of the information required to return more values around until the resource is dropped, and can return an error in the case of insufficient memory, consistency issues, etc
- Resources are unforgable
- Resources are opaque
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading wit/store.wit, especially the key-response definition at lines 44-46 and bucket.list-keys at lines 104-120. Compare the current string cursor model with the proposed cursor resource and document the required spec changes, including pagination and cursor-error behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100