Summary: See D14279065, this diff is simply to clean up the deprecated code
Reviewed By: StanislavGlebik
Differential Revision: D14279210
fbshipit-source-id: 10801fb04ad533a80bb7a2f9dcdf3ee5906aa68d
Summary: The username and ssh vars are both properties of request, so they fit nicely inside per request CoreContext. They will be used in verify_integrity hook.
Reviewed By: StanislavGlebik
Differential Revision: D14385840
fbshipit-source-id: 9fe3cb96ffa89d8b017c730e37ca9ea4124ede0c
Summary: Add an optional `depth` parameter to the `getfilehistory` endpoint, allowing the caller to specify the maximum number of history entries to fetch.
Differential Revision: D14222991
fbshipit-source-id: 8b28c9674e764f0098a9780f94ef2957ef117f09
Summary: Optionally specify a max depth for history fetching.
Reviewed By: StanislavGlebik
Differential Revision: D14218337
fbshipit-source-id: b6b92181172637e58a43bf61793257559915c7f1
Summary:
Move most of the fb303 methods from `fb303.FacebookService` to
`fb303_core.BaseService`.
A few methods have been left behind. In most cases these are methods that are
either already deprecated or that we would like to deprecate in the future.
One important method that is not being moved as part of this diff is
`getStatus()`. We do want to move this to `BaseService` in the future, but
doing so is a bit more challenging than the other methods, since it also uses
a custom enum that will need to be moved from `fb303.thrift` to
`fb303_core.thrift`. In most languages this can be done relatively easily
by replacing it with a typedef in `fb303.thrift`. Unfortunately the `py3`
thrift generator does not handle typedefs well, so more work will need to be
done to enable this for python3 thrift code.
Reviewed By: yfeldblum
Differential Revision: D13688965
fbshipit-source-id: 48d3d007ef6b63b4176cab753624813b7f9d6526
Summary: This diff adds a new `getfilehistory` endpoint to the API server that takes a filenode/path pair and returns a stream of JSON-encoded history entries (corresponding to `types::LooseHistoryEntry`) representing the full history of that filenode. (Note that the particular serialization format can be changed relatively easily in the future; for now I've chosen JSON for ease of debugging.)
Reviewed By: StanislavGlebik
Differential Revision: D14197233
fbshipit-source-id: 390f2e528f36fa3ec4b402e2fc3def0f2d529432
Summary: Convert the API Server to Rust 2018 edition.
Reviewed By: StanislavGlebik
Differential Revision: D14222621
fbshipit-source-id: 4afd8a57c415cfd5b5923d15cb2873a1c098f861
Summary: The Cargo.toml file for the API server appears to be from a very old prototype version. It is tiny and barely captures any of the current dependencies (many of which can't be built with Cargo anyway). Let's delete it since it's not adding any value.
Reviewed By: StanislavGlebik
Differential Revision: D14222619
fbshipit-source-id: c7ce625da859ae6fa85e787a6e92a2795c8420c5
Summary:
The main module of the API server is growing pretty large, since a new method and query parameters struct is required for each new HTTP endpoint added to the server. To make this manageable, let's restructure the code so that each handler function is paired with a params struct that contains its corresponding params.
This makes it easier to make changes to individual handlers, such as switching the method GET to a POST and changing the handler to read the params from the request body.
Reviewed By: StanislavGlebik
Differential Revision: D14222620
fbshipit-source-id: 67abea2ff32a3d6cc278375efd368fa2969ab891
Summary: This diff added "manifest" field to Mononoke API Server's `get_changeset` method, which is required to implement Eden's `BackingStore::getTreeForCommit`
Reviewed By: StanislavGlebik
Differential Revision: D13966576
fbshipit-source-id: d2444b3aab477ab76efa7baddf114d90fa7a7a77
Summary: Add a thrift method `get_tree` to Mononoke API Server
Reviewed By: StanislavGlebik
Differential Revision: D13964085
fbshipit-source-id: c0d31e4e13079bec49d480c116ebb300c7e4260f
Summary: This is needed to enable D14085659. Currently we do not have access to the core context when actually logging stuff. This change will not affect http api as Im not sure how to send the context to the middleware.
Reviewed By: StanislavGlebik
Differential Revision: D14081760
fbshipit-source-id: 6c3e8e1e7d153fbac62c842130e9caf51e5aac5a
Summary: use common funcions to parse --myrouter-port, this is a simple clean up
Reviewed By: StanislavGlebik
Differential Revision: D14084003
fbshipit-source-id: 63d6c8301e977faead62cb1c705bac372d56594e
Summary: New commits should be logged to scribe, these will be used to trigger the update for the hg clone streamfile.
Reviewed By: lukaspiatkowski
Differential Revision: D14022599
fbshipit-source-id: a8a68f12a8dc1e65663d1ccf1a5eafa54ca2daf0
Summary:
Update the `fb303.FacebookService` type to derive from the new
`fb303_core.BaseService` definition. This is in preparation to begin moving
most of the fb303 methods to `BaseService`.
Unfortunately the Rust thrift compiler does not handle service inheritance
very well, so all existing rust thrift servers need to be updated to handle
this change.
Reviewed By: wez
Differential Revision: D13683717
fbshipit-source-id: c6ba8dcbadd05d674b7a75ea531500268e4bc3f2
Summary:
Populating skiplist at startup takes up to 3 minutes when not compiling in prod mode. This allows developers to turn this off and just use an empty skiplist (this only affects historical queries, and those can still be tested using recent commits)
The reason for negating the flag is to not hide core functionality behind a flag.
Reviewed By: StanislavGlebik
Differential Revision: D13986936
fbshipit-source-id: 053ecbd27aeeaa97f03194933e1d904a3e60ffcc
Summary:
I decided against using the naming convention maybe_ancestor and maybe_descendant as I believe the name is_ancestor already implies this uncertainty.
Skiplist is used instead of bfs, this improves performance significantly when using very old commits. For now we do not update skiplist as more recent commits are in cache anyway.
Reviewed By: StanislavGlebik
Differential Revision: D13917333
fbshipit-source-id: 21b49d920ff473c953a952ee3c6d7b55565f98ac
Summary: HgFileNodeId is a stronger typed id, so it is prefered to use it instead of HgNodeHash whenever it is identifying a filenode
Reviewed By: aslpavel
Differential Revision: D13986172
fbshipit-source-id: c0334652345acb868e86c38b8c0045e9c023c176
Summary: The Copy trait means that something is so cheap to copy that you don't even need to explicitly do `.clone()` on it. As it doesn't make much sense to pass &i64 it also doesn't make much sense to pass &<Something that is Copy>, so I have removed all the occurences of passing one of ouf hashes that are Copy.
Reviewed By: fanzeyi
Differential Revision: D13974622
fbshipit-source-id: 89efc1c1e29269cc2e77dcb124964265c344f519
Summary:
Apiserver should log success and not rely on scmquery-proxy for that. Also did some refactoring:
1. cleaned up .timed methods in the thrift section
2. Moved the creation of ScubaSampleBuilder to one central location so common logging data doesnt have to be added to both http and thrift section
Reviewed By: StanislavGlebik
Differential Revision: D13895685
fbshipit-source-id: 3c6295e172f8ccaabaf38f436b304b5cb717deca
Summary:
`blobrepo_factory` is a crate that knows how to create blobrepo given
a configuration i.e. it creates blobstores, filenodes, changesets etc and
initializes blobrepo with them.
`post_commit` is a small part of blobrepo which can also be extracted from
blobrepo crate.
There are a few upsides with this approach
1) Less dependencies on Blobrepo, meaning we have to rebuild it fewer times
2) BlobRepo compilation is faster
Reviewed By: jsgf
Differential Revision: D13896334
fbshipit-source-id: 1f5701341f01fcefff4e5f9430ddc914b9496064
Summary: Add a `/getfile/` endpoint that takes a filenode and returns Mercurial file content. This is similar to the `/blob/` endpoint, except the returned content can also include copy information in the case that the file was copied. This matches the exact format in which Mercurial stores file content, so the resulting output can be directly written to disk.
Reviewed By: chadaustin
Differential Revision: D13876096
fbshipit-source-id: 0417cb1f993c4c93687e364b1647490c3a9040bc
Summary:
At From<Error>::from errors are automatically downcast into an InternalError. While we unwrap them for http this was not done for thrift, resulting in an InternalError being returned for everything. By unwrapping the error first thrift now returns more meaningful errors.
In addition I added a new errorkind for ls_v2, this is purely for internal structure as the client will still see an InvalidInput error.
Reviewed By: StanislavGlebik
Differential Revision: D13881374
fbshipit-source-id: bd2e43a0ac7e5abdbf41068c3b1ab37681f03009
Summary:
Let's split reachability index crate. The main goal is to reduce compilation
time. Now crates like revsets will only depend on traits definition but not on
the actual implementation (skiplist of genbfs).
Reviewed By: lukaspiatkowski
Differential Revision: D13878403
fbshipit-source-id: 022eca50ac4bc7416e9fe5f3104f0a9a65195b26
Summary:
Currently if a crate depends even on a single type from metaconfig then in
order to compile this trait buck first compiles metaconfig crate with all the
logic of parsing the configs.
This diff split metaconfig into two crates. The first one just holds the types for
"external consumption" by other crates. The second holds the parsing logic.
That makes builds faster
Reviewed By: jsgf, lukaspiatkowski
Differential Revision: D13877592
fbshipit-source-id: f353fb2d1737845bf1fa0de515ff8ef131020063
Summary:
The main reason to do it is to remove dependency from cmdlib to repo_client.
repo_client depends on a lot of other crates like bundle2-resolver, hooks etc.
And it means that in order to compile mononoke_admin we need to compile these
crates too. By moving open_blobrepo into blobrepo crate we are removing
unnecessary dependencies.
Also let's remove unused blobrepo type
Reviewed By: aslpavel
Differential Revision: D13848878
fbshipit-source-id: cd3d04354649cdb5b2947f08762051318725c781
Summary: This is to take the guesswork out of revisions. MononokeRevision now states explicitely whether the value is a hash or bookmark. To roll this out I will prepare an updated scmquery-proxy version, test everything on shadow. Then use the sitevar to disable mononoke usage for a short time while both apisever and scmquery-proxy are rolled out simultaneously
Reviewed By: StanislavGlebik
Differential Revision: D13817040
fbshipit-source-id: d5eee7cf9ac972fb1313a10a17bf60c4545054af
Summary: Ran rustfmt on the complete folder
Reviewed By: HarveyHunt
Differential Revision: D13803235
fbshipit-source-id: ccb41d7be8099055b8ea8dec57ce5e04b38b9461
Summary: Create the corresponding endpoint for thrift calls to get_commit_v2. For now this only supports the non optional fields.
Reviewed By: StanislavGlebik
Differential Revision: D13730602
fbshipit-source-id: fd9d845620c864bf7dade13d810e98270425ea00
Summary: Log all thrift calls to scuba. Since the params are in thrift format we log them both in json and human readable format (e.g. path is binary thus not really readable in json format). In addition both http and thrift now log the request type.
Reviewed By: StanislavGlebik
Differential Revision: D13730245
fbshipit-source-id: 3419ec067a9066e181210d184195fbd02980c1e0
Summary: `BlobRepo` is cheaply clonable and doesn't need to be `Arc`'d.
Reviewed By: StanislavGlebik
Differential Revision: D13726727
fbshipit-source-id: 0b983c7c4625f47df8a11da5781b7777cc38d72f
Summary:
Reformat several rust files with the current rustfmt, to make the linter
happy.
Reviewed By: yfeldblum
Differential Revision: D13683205
fbshipit-source-id: f7a02dae0fbe095b6acde4de380aca2acfedf39d
Summary: MyRouter and cache support will come in next diffs
Reviewed By: StanislavGlebik
Differential Revision: D13465146
fbshipit-source-id: 0ede0e875d4a49794ff71173bd0d1563abb3ff08
Summary:
We need to add python exports to our TARGETS file to enable scmquery
to create a ServiceRouter Client for mononoke-api
Reviewed By: StanislavGlebik
Differential Revision: D13651275
fbshipit-source-id: ba5a4eb3665dae1ea127f4ceb96c1ce62e1e4563
Summary: There's nothing Mercurial-specific about identifying a repo. This also outright removes some dependencies on mercurial-types.
Reviewed By: StanislavGlebik
Differential Revision: D13512616
fbshipit-source-id: 4496a93a8d4e56cd6ca319dfd8effc71e694ff3e
Summary:
We've moved to the new config structure, I forgot to make the same changes to
apiserver
Reviewed By: lukaspiatkowski
Differential Revision: D13358407
fbshipit-source-id: cec81a21518cdb3c91dabb93e220d1ba3e25d02c
Summary:
`env_logger` was enabled in D12934682 to assist with debugging production TLS
issues with the Mononoke API server VIP. It turns out that this was actually
not neccesary due to the slog_stdlog crate. As such, remove env_logger from the
API server.
Reviewed By: StanislavGlebik
Differential Revision: D13328349
fbshipit-source-id: c5ed33d5afe96f4823ce637de892188e95c647fa
Summary: Restructure the configs so that we can specify more than one blobstore
Reviewed By: lukaspiatkowski
Differential Revision: D13234286
fbshipit-source-id: a98ede17921ed6148add570288ac23636b086398