couchbeam icon indicating copy to clipboard operation
couchbeam copied to clipboard

candidate for async save_doc

Open mcqueenorama opened this issue 11 years ago • 2 comments

Can you have a look at my repo? In particular see examples/async_stream_to_save.erl and examples/async_save_inline.erl.

I don't want to make a pull request for it since its a bit experimental. It exposes the hackney async function to save_doc. I bet there's a better way to do it, but I couldn't figure it out. There's one small change needed in couchbeam_uuids, and the atom async didn't seem to work, but {async, true} does. I had to force the call to get_new_uuids is forced to go syncronously, but that's only rarely used, so its probably OK.

Also it uses hackney_disp.

mcqueenorama avatar Sep 11 '14 05:09 mcqueenorama

Sorry for the late answer, but what would be the purpose? Not waiting for the result but still beeing able to check if it arrived?

In that case I would prefer an api like this one: save_doc(..., [{async, AsyncOption}]) With the possibility to wait for a result in a pid or just ignore it totally. The result would be just {DocId, Result}) Eventually we could add some metadata.

Thoughts?

benoitc avatar Oct 28 '14 15:10 benoitc

ping.

benoitc avatar Jan 02 '15 10:01 benoitc