sapling/eden/mononoke/lfs_protocol
Thomas Orozco 399fd6c573 mononoke/{edenapi,lfs}_server: update to new Hyper, new Bytes, new Gotham
Summary:
This updates the lfs server and eden api server to use a newer version of
Gotham, which comes along with an updated version of Bytes and Hyper.

A few things had to change for this:

- New bytes don't support concatenation, so we need to fold them ourselves,
  except...
- ... new Hyper bodies don't tell you how big they are (either in requests or
  responses), so we need to inspect headers to find the size instead (I added
  this in `gotham_ext::body_ext::BodyExt`, although it arguably belongs more in
  a `hyper_ext` crate, but creating a new crate for just this seems overkill).
- New Hyper requires its data stream to be `Sync` for reasons that have more to
  do with developer experience than runtime
  (https://github.com/hyperium/hyper/pull/1857). Unfortunately, our Filestore
  streams aren't `Sync`, because our `BoxFuture` contains a `dyn Future` that
  isn't explicitly `Sync` (which is how we pull things out of blobstores). Even
  if `BoxFuture` contained a `Sync` future, that still wouldn't be enough
  anyway, because `compat()` explicitly implements `!Sync` on the stream it
  returns. I'll ask upstream in Hyper if this can possibly change in the
  future, but for now we can work around it by wrapping the stream in a
  channel. I'll keep an eye out for performance here.
- When I updated our "pre state data" tweaks on top of Gotham, I renamed those
  to "socket data", since that's a better name or what they are (hence the
  changes here).
- I updated the lfs_protocol to stop depending on Hyper and instead depend on
  http, since that's all we need here.

As you review this, please pay close attention to the updated implementation of
`SignalStream`. Since this is a custom `Stream` in new futures, it requires a
bit of `unsafe { ... }`.

Note that, unfortunately, the diff includes both the Gotham update and the
server updates, since they have to happen together.

Reviewed By: kulshrax, dtolnay

Differential Revision: D20342689

fbshipit-source-id: a490db96ca7c4da8ff761cb80c1e7e3c836bad87
2020-03-11 10:22:28 -07:00
..
src mononoke/{edenapi,lfs}_server: update to new Hyper, new Bytes, new Gotham 2020-03-11 10:22:28 -07:00
Cargo.toml mononoke/{edenapi,lfs}_server: update to new Hyper, new Bytes, new Gotham 2020-03-11 10:22:28 -07:00