batch::get-many should parallel store.get - #55
Conversation
8d9ff50 to
071dcdd
Compare
Signed-off-by: David Justice <david@devigned.com>
071dcdd to
60f63ec
Compare
Mossaka
left a comment
There was a problem hiding this comment.
this makes sense to me.
Since this updates the APIs, can you bump the draft version up?
|
I can go either way on this. I think we may have had it the way you have it in this PR before, but I swapped it out because you have to return a copy of the key. For a batch request, that means even if you have no data to show, you have to return a new key (which could be quite large for some people). Since batch requests are big, this is where extra allocations of keys could matter. I swapped it to the option because it should be returned in the same order as passed in, so if you absolutely need to know which key you need, you can refer to that. Here are our options and the tradeoffs: What you have in this PR: Advantages: Easiest to consume because you have each KV pair Current: Advantages: No extra allocations of non-existent keys Option 3 Advantages: No extra allocation of keys So I think those are the options. After putting some thought into it here, I'd rather have option 3 to avoid all sorts of extra memory usage (and copying), but we should decide together what we'd prefer here |
|
@thomastaylor312 if we want "no extra allocations of non-existent keys", I think I think the current one is the worst, because I can't think of any use case of having None in the list, |
Update the doc comment to make it explicit that the returned list always contains one entry per requested key, with `none` for the value if the key does not exist. Regenerate imports.md and watch-service.md to match.
The v22 action fails because it looks for a pre-built binary at tag `wit-bindgen-cli-0.32.0` which no longer exists. The v25 action uses cargo install with caching instead, which resolves the tool from crates.io and works for any published version.
danbugs
left a comment
There was a problem hiding this comment.
Updated the doc comment as requested and also updated the wit-abi-up-to-date tooling version to get a passing CI. LGTM.
in store returns an
option<list<u8>>, butin batch returns
list<option<tuple<string, list<u8>>>>. I would expectget-manyto returnresult<list<tuple<string, option<list<u8>>>>, error>;.