Commit Graph

7 Commits

Author SHA1 Message Date
Arun Kulshreshtha
6181da2178 edenapi: add method to get file history
Summary: Add a `get_history()` method to the `EdenApi` trait that queries the API server's `getfilehistory` endpoint and writes the resulting history entries to a historypack in the user's cache.

Differential Revision: D14223269

fbshipit-source-id: bf69c767f5a89177c36e755250330dbbbc219e4f
2019-02-28 15:42:17 -08:00
Arun Kulshreshtha
9c6b914a22 types: move Key and NodeInfo out of revisionstore
Summary:
In order to move the types in `edenapi-types` (containing types shared between Mercurial and Mononoke) to the `types` crate, we need to move a few types from the  `revisionstore` crate into this crate first, because `revisionstore` depends on `types`, which would create a circular dependency since `edenapi-types` uses types from `revisionstore`.

In particular, this diff moves the `Key` and `NodeInfo` types into their own modules in the `types` crate.

Reviewed By: quark-zju

Differential Revision: D14114166

fbshipit-source-id: 8f9e78d610425faec9dc89ecc9e450651d24177a
2019-02-15 22:51:04 -08:00
Arun Kulshreshtha
127ca1a990 edenapi: use rustls instead of openssl
Summary:
Switch from using OpenSSL (via `native-tls`) to [Rustls](https://github.com/ctz/rustls), a pure-Rust TLS implementation based on the `ring` crypto crate.

Unlike `native-tls`, Rustls supports ALPN, which means it can be used along with Hyper to perform HTTP/2 requests over TLS. (OpenSSL also supports ALPN, but older versions of Windows' `schannel` library do not, and as such `native-tls` doesn't support ALPN either regardless of platform.)

Rustls also builds on Windows without any special configuration, sidestepping the issues we've been having with OpenSSL in the Windows build.

Reviewed By: quark-zju

Differential Revision: D14070084

fbshipit-source-id: 25268c58a88177f4708370696d326b4c0bdc89a0
2019-02-13 16:07:00 -08:00
Arun Kulshreshtha
f7bbff1ceb edenapi: do not enforce HTTP/2 only
Summary: It turns out that `hyper-tls` does not support ALPN for negotiating HTTP/2 connections, and only supports HTTP/2 prior knowledge. (This is a limitation of the underlying TLS library, `native-tls`.) Unfortunately, while the Mononoke API server itself is fine with HTTP/2 prior knowledge for non-TLS connections, the Mononoke VIPs require TLS, and thus per the HTTP/2 spec require ALPN negotiation from an HTTP/1.1 initial connection. As a result, we need to revert back to using HTTP/1.1 for now in order to use TLS.

Reviewed By: singhsrb

Differential Revision: D14015335

fbshipit-source-id: b78197d4cfecf184479162c5b14ba54cbef66ee7
2019-02-11 09:54:22 -08:00
Arun Kulshreshtha
bdecba1c92 edenapi: enforce HTTP/2 prior knowledge
Summary: Ensure that Hyper uses HTTP/2, since we'd like to support connection reuse and multiplexing.

Reviewed By: DurhamG

Differential Revision: D13925320

fbshipit-source-id: 0f39e66fe35a0dc95966d16772d1ab8988067c11
2019-02-05 21:22:48 -08:00
Arun Kulshreshtha
5f6998719e edenapi: add static builder() method to get a client Builder
Summary: In Rust it is typically more idiomatic to have a static method on a struct to produce a builder, since this means the builder doesn't need to be explicitly imported to construct a new instance of the struct.

Reviewed By: DurhamG

Differential Revision: D13925323

fbshipit-source-id: c06d5d42ba941dbbb2c619f9470e79fa23f35f68
2019-02-05 21:22:48 -08:00
Arun Kulshreshtha
70aff50986 edenapi: rename mononokeapi to edenapi
Summary: Rename Mononoke API to Eden API, per war room discussion.

Reviewed By: quark-zju

Differential Revision: D13908195

fbshipit-source-id: 94a2fe93f8a89d0c5e9b6a24939cc4760cfaade0
2019-02-05 21:22:48 -08:00