mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
0b5ae6e2bf
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 |
||
---|---|---|
.. | ||
fs | ||
integration | ||
locale | ||
mononoke | ||
scm | ||
scripts | ||
test_support | ||
test-data | ||
win | ||
.clang-format | ||
.gitignore | ||
Eden.project.toml |