sapling/eden
Arun Kulshreshtha 0b5ae6e2bf http_client: add async batch interface
Summary:
Add the methods `send_async` and `send_async_with_progress` to `HttpClient`. These methods provide a `Futures`-based async interface that will make it easy to use the client from async Rust code.

Just like in D22231555, this is built on top of the previously introduced streaming API. When a batch request is sent, the client will start a Multi session on a task in a blocking worker thread using `tokio::task::spawn_blocking`. This means that right now, the implementation is not /truly/ async, but it should be possible to change the implementation in the future to avoid using any blocking I/O without needing to change the public interface.

Since all of the requests are part of the same Multi session, they will all proceed concurrently and, if possible, be multiplexed over the same connection in the case of multiple HTTP/2 requests to the same server (which is going to be our main use-case).

Unfortunately, since libcurl does not have any internal synchronization, ownership of the Multi session needs to be passed to the worker thread, meaning that the Multi handle will be dropped once the requests are complete. This means that connections will not be re-used when these methods are called several times serially. The API should make it obvious to the user that the internal state is not preserved since these methods both consume the `HttpClient` itself.

Reviewed By: quark-zju

Differential Revision: D22251488

fbshipit-source-id: 37caf64024cb12b95df5124379209550899d093d
2020-06-30 21:10:40 -07:00
..
fs fix AssertionError if a checkout is in the middle of a merge 2020-06-30 13:58:21 -07:00
integration fix AssertionError if a checkout is in the middle of a merge 2020-06-30 13:58:21 -07:00
locale add a copyright header to glibc_en.po 2019-04-26 14:38:27 -07:00
mononoke mononoke/repo_import: add rewrite_commit functionality 2020-06-30 11:39:35 -07:00
scm http_client: add async batch interface 2020-06-30 21:10:40 -07:00
scripts packaging: use scheduled tasks 2020-06-10 19:29:15 -07:00
test_support enable asynchronous integration tests 2020-06-15 15:53:50 -07:00
test-data enable treemanifest in snapshots 2019-08-28 18:46:03 -07:00
win add .clang-format 2020-04-28 08:42:03 -07:00
.clang-format Cut FOR_EACH_KV 2020-06-10 19:29:43 -07:00
.gitignore eden: wire up mac contbuild 2019-02-05 21:52:30 -08:00
Eden.project.toml Eden.project.toml file for Nuclide 2018-04-26 11:05:23 -07:00