Commit Graph

105 Commits

Author SHA1 Message Date
Mark Thomas
b56a1b5b2c scs_server: add repo_list_hg_manifest
Summary:
To allow EdenFS to get aux manifest data from Mononoke without needing to derive fsnodes, provide
a mechanism to list a manifest using the hg manifest id that returns the size and content hashes
of each of the files.

NOTE: this is temporary until the EdenAPI server is fully online and serving this data.

Reviewed By: krallin

Differential Revision: D22975967

fbshipit-source-id: 0a25da6d74534d42fc3b5f38ba3b72107b209681
2020-08-06 11:28:11 -07:00
Stefan Filip
2f3e569120 mononoke_api: add segmented changelog location to hash translation
Summary:
This functionality is going to be used in EdenApi. The translation is required
to unblock removing the changelog from the local copy of the repositories.
However the functionality is not going to be turned on in production just yet.

Reviewed By: kulshrax

Differential Revision: D22869062

fbshipit-source-id: 03a5a4ccc01dddf06ef3fb3a4266d2bfeaaa8bd2
2020-08-04 11:22:39 -07:00
Stanislau Hlebik
cd2a3fcf32 mononoke: add allow_bookmark_update_delay
Summary:
Follow up from D22819791.
We want to use bookmark update delay only in scs, so let's configure it this
way

Reviewed By: krallin

Differential Revision: D22847143

fbshipit-source-id: b863d7fa4bf861ffe5d53a6a2d5ec44e7f60eb1a
2020-07-31 03:09:24 -07:00
Stanislau Hlebik
43ac2a1c62 mononoke: use WarmBookmarkCache in repo_client
Summary:
This is the (almost) final diff to introduce WarmBookmarksCache in repo_client.
A lot of this code is to pass through the config value, but a few things I'd
like to point out:
1) Warm bookmark cache is enabled from config, but it can be killswitched using
a tunable.
2) WarmBookmarksCache in scs derives all derived data, but for repo_client I
decided to derive just hg changeset. The main motivation is to not change the
current behaviour, and to make mononoke server more resilient to failures in
other derived data types.
3) Note that WarmBookmarksCache doesn't obsolete SessionBookmarksCache that was
introduced earlier, but rather it complements it. If WarmBookmarksCache is
enabled, then SessionBookmarksCache reads the bookmarks from it and not from
db.
4) There's one exception in point #3 - if we just did a push then we read
bookmarks from db rather than from bookmarks cache (see
update_publishing_bookmarks_after_push() method). This is done intentionally -
after push is finished we want to return the latest updated bookmarks to the
client (because the client has just moved a bookmark after all!).
I'd argue that the current code is a bit sketchy already - it doesn't read from
master but from replica, which means we could still see outdated bookmarks.

Reviewed By: krallin

Differential Revision: D22820879

fbshipit-source-id: 64a0aa0311edf17ad4cb548993d1d841aa320958
2020-07-31 03:09:24 -07:00
Mateusz Kwapich
d1322c621d don't error out when path doesn't exist
Summary:
Most out our APIs throw error when the path doesn't exist. I would like to
argue that's not the right choice for list_file_history.

Errors should be only retuned in abnormal situations and with
`history_across_deletions` param there's no other easy way to check if the file
ever existed other than calling this API - so it's not abnormal to call
it with path that doesn't exist in the repo.

Reviewed By: StanislavGlebik

Differential Revision: D22820263

fbshipit-source-id: 002bda2ef5ee9d6632259a333b7f3652cfb7aa6b
2020-07-30 03:25:01 -07:00
Mateusz Kwapich
3b36868c5c add descendants_of arg to changeset_path history
Summary: Thiss turned out to be quite complex

Differential Revision: D22502591

fbshipit-source-id: 4bd9b90e9c88c234b84fbea2221036387a037ba3
2020-07-23 07:34:52 -07:00
Mateusz Kwapich
52863fa3e3 remove terminator argument
Summary: now the terminator argument is unused - we can get rid of it.

Differential Revision: D22502594

fbshipit-source-id: e8ecec01002421baee38be0c7e048d08068f2d74
2020-07-23 07:34:52 -07:00
Mateusz Kwapich
39c0b018ce migrate time filters to use visitor
Summary:
`until_timestamp` will benefit from checking each node - this will allow for
less filtering on the caller side.

Differential Revision: D22502595

fbshipit-source-id: 23c574b0a4eeb700cf7ea8c1ea29e3a6520097a9
2020-07-23 07:34:52 -07:00
Mateusz Kwapich
451c5e9827 introduce a Visitor trait
Summary:
This new trait is going to replace the `Terminator` argument to fastlog
traversal function. Insted of deciding if we should fetch or/not given fastlog
batch this trait allows us to make decisions based on each visited changeset.

Differential Revision: D22502590

fbshipit-source-id: 19f9218958604b2bcb68203c9646b3c9b433541d
2020-07-23 07:34:52 -07:00
Arun Kulshreshtha
edb856a77e mononoke_api: use create_getpack_v2_blob in HgFileContext
Summary: Use `create_getpack_v2_blob` instead of `create_getpack_v1_blob` for fetching file content because the former also provides metadata, which is required to support LFS.

Reviewed By: quark-zju

Differential Revision: D22564950

fbshipit-source-id: 2835160a9dfd18b80cd13e4a5dbcf6f4ce2f4579
2020-07-22 10:37:14 -07:00
Kostia Balytskyi
fc61c74f23 live_commit_sync_config: make scs xrepo-lookup watch live changes
Summary:
When we change `CommitSyncConfig`, we want to not have to restart `scs` servers, and instead have them pick up the new config by using `LiveCommitSyncConfig`.

This diff turned out larger than I expected, mainly due to the need to introduce various things around `TestLiveCommitSyncConfig`:
- `TestLiveCommitSyncConfig`: the trait implementer to use in `mononoke_api::Repo`
- `TestLiveCommitSyncConfigSource`: the helper struct to keep around for new values injection (very similar to how our `ConfigStore` has an inner `ConfigSource`, which can also be `TestSource`, but here injected values can be `CommitSyncConfig` instead of JSON).
- all the places in integration tests, where `setup_configerator_configs` is now needed (I plan to start setting up configerator configs always in a separate diff, as it is cheap)

Here are the explanations for a few things I think may be not immediately obvious:
- I removed the `Clone` bound from `LiveCommitSyncConfig` trait, as `Clone` traits [cannot be made into trait objects](https://doc.rust-lang.org/book/ch17-02-trait-objects.html#object-safety-is-required-for-trait-objects)
- `TestLiveCommitSyncConfigSource` vs `TestLiveCommitSyncConfigSourceInner` discrepancy is to ensure nobody should instantiate `TestLiveCommitSyncConfigSourceInner` outside of `live_commit_sync_config/src`
- I am aware of the ugly discrepancy between the main `--mononoke-config-path`, which is used to load initial configuration and can be both a file-based and a configerator-based config; and `--local-configerator-path`, used to override config sources for `Tunables` and `LiveCommitSyncConfig`. Ideally these two should just be unified somehow, but that is a little out of scope of this diff (I've already added it to the dirt doc though).
- in `mononoke_api::Repo` there are methods `new_test_xrepo` and `new_test_common`, which changed from maybe accepting just a `CommitSyncConfig` to now maybe accepting both `CommitSyncConfig` and `LiveCommitSyncConfig`. It can be made a bit cleaner: I can just query `CommitSyncConfig` from `LiveCommitSyncConfig` in `new_test_common` and avoid having two args. I was too lazy to do this, lmk if you feel strongly about it.

Reviewed By: StanislavGlebik

Differential Revision: D22443623

fbshipit-source-id: 0d6bbda2223e77b89cc59863b703db5081bcd601
2020-07-21 09:09:23 -07:00
Mateusz Kwapich
0a8aaa461c repo_stack_info: return queue when the limit is hit
Summary:
This allows clients to get more commits in the followup query, also it lets the
clients know that the limit was reached.

Reviewed By: markbt

Differential Revision: D22576875

fbshipit-source-id: 93de20b1033cd5d0cdf902a418d7b727b03d2d08
2020-07-20 10:39:52 -07:00
Mateusz Kwapich
3547ffd3a9 repo_stack_info: make the repo_stack_info results ordered
Summary:
We already traverse in useful order, let's preserve this order as it's natural
for clients to expect some kind of topological ordering.

Reviewed By: markbt

Differential Revision: D22576873

fbshipit-source-id: 32a6f0de1ba9cc473e57b5a69fde538dfe8a3d75
2020-07-20 10:39:52 -07:00
Mateusz Kwapich
6bc6730839 repo_stack_info: limit the output size, not traversal depth.
Summary:
The customers need our queries to return a predictable amounts of output
whilist limiting the depth doesn't really do it: the output may be
theoretically exponential.

Reviewed By: markbt

Differential Revision: D22576874

fbshipit-source-id: 65c793b229889c0cf26af693537ed6dbc0d33ebd
2020-07-20 10:39:52 -07:00
Stanislau Hlebik
8daaacbd77 mononoke: log repo name when bookmark is missing
Summary:
Logs showed that one of the repo is missing a bookmark, however it wasn't clear
which repo. Let's log it to make it clearer.

Reviewed By: HarveyHunt

Differential Revision: D22500793

fbshipit-source-id: c1d5fce66d7b2b119c7365d13511a7e9a6d6ed3f
2020-07-13 02:47:20 -07:00
Mark Thomas
fb5fdb9c15 bookmarks: remove repo_id from Bookmarks methods
Summary:
Remove the `repo_id` parameter from the `Bookmarks` trait methods.

The `repo_id` parameters was intended to allow a single `Bookmarks` implementation
to serve multiple repos.  In practise, however, each repo has its own config, which
results in a separate `Bookmarks` instance for each repo.  The `repo_id` parameter
complicates the API and provides no benefit.

To make this work, we switch to the `Builder` pattern for `SqlBookmarks`, which
allows us to inject the `repo_id` at construction time.  In fact nothing here
prevents us from adding back-end sharing later on, as these `SqlBookmarks` objects
are free to share data in their implementation.

Reviewed By: StanislavGlebik

Differential Revision: D22437089

fbshipit-source-id: d20e08ce6313108b74912683c620d25d6bf7ca01
2020-07-10 04:50:25 -07:00
Mark Thomas
3afceb0e2c bookmarks: extract BundleReplayData from BookmarkUpdateReason
Summary:
Separate out the `BundleReplayData` from the `BookmarkUpdateReason` enum.  There's
no real need for this to be part of the reason, and removing it means we can
abstract away the remaining dependency on Mercurial changeset IDs from
the main bookmarks traits.

Reviewed By: mitrandir77, ikostia

Differential Revision: D22417659

fbshipit-source-id: c8e5af7ba57d10a90c86437b59c0d48e587e730e
2020-07-10 04:50:24 -07:00
Arun Kulshreshtha
5f0181f48c Regenerate all Cargo.tomls after upgrade to futures 0.3.5
Summary: D22381744 updated the version of `futures` in third-party/rust to 0.3.5, but did not regenerate the autocargo-managed Cargo.toml files in the repo. Although this is a semver-compatible change (and therefore should not break anything), it means that affected projects would see changes to all of their Cargo.toml files the next time they ran `cargo autocargo`.

Reviewed By: dtolnay

Differential Revision: D22403809

fbshipit-source-id: eb1fdbaf69c99549309da0f67c9bebcb69c1131b
2020-07-06 20:49:43 -07:00
Mark Thomas
309e4539ab mononoke_api: bypass cache for old bookmark location in move_bookmark
Summary:
Currently the `move_bookmark` API needs to get the old bookmark location in order
to move the bookmark.  We'll fix that in general later, but for now we need to
make sure the value we use doesn't come from an out-of-date cache (e.g. the
warm_bookmarks_cache), as it may prevent the move from working.

Reviewed By: krallin

Differential Revision: D22358467

fbshipit-source-id: 4d46a6be717644b24663318326fdcd81249481c9
2020-07-02 11:01:04 -07:00
Mark Thomas
6d5bce25c6 mononoke_api: implement pagination for all bookmarks
Summary:
Bookmark requests that are truncated because the requested limit is reached now return a `continue_after` value, containing the last bookmark that was processed.

Callers can make a subsequent request with the same parameters, but `after` set to the value received in `continue_after` to continue their request where it left off.

Reviewed By: krallin

Differential Revision: D22338301

fbshipit-source-id: 81e398bee444e0960e65dc3b4cdbbe877aff926d
2020-07-02 07:53:12 -07:00
Mark Thomas
742eb6f829 bookmarks: rework Bookmarks traits
Summary:
Rework the bookmarks traits:

* Split out log functions into a separate `BookmarkUpdateLog` trait.  The cache doesn't care about these methods.

* Simplify `list` down to a single method with appropriate filtering parameters.  We want to add more filtering types, and adding more methods for each possible combination will be messier.

* The `Bookmarks` and `BookmarkUpdateLog` traits become `attributes` on `BlobRepo`, rather than being a named member.

Reorganise the bookmarks crate to separate out the bookmarks log and transactions into their own modules.

Reviewed By: krallin

Differential Revision: D22307781

fbshipit-source-id: 4fe514df8b7ef92ed3def80b21a16e196d916c64
2020-07-02 07:53:12 -07:00
Mateusz Kwapich
15256a91be add an option to limit commit_history to descendants of commit
Summary: This will be used for commits_between replacement

Differential Revision: D22234236

fbshipit-source-id: c0c8550d97a9e8b42034d605e24ff54251fbd13e
2020-06-30 08:09:30 -07:00
Mateusz Kwapich
66a810a68c new history format
Summary: Some SCMQuery queries need just a list of commit hashes instead of full coverage.

Reviewed By: markbt

Differential Revision: D22165006

fbshipit-source-id: 9eeeab72bc4c88ce040d9d2f1a7df555a11fb5ae
2020-06-30 08:09:30 -07:00
Mateusz Kwapich
398ab603c2 add into_response that would map commit ids across identity schemes
Summary: This way we can go from list of changesets into changet ids that we're returning as an answer in few queries.

Differential Revision: D22165005

fbshipit-source-id: 4da8ab2a89be0de34b2870044e44d35424be5510
2020-06-30 08:09:30 -07:00
Mark Thomas
160936b732 bookmarks: convert to new-style BoxFutures and BoxStreams
Summary: Convert the bookmarks traits to use new-style `BoxFuture<'static>` and `BoxStream<'static>`.  This is a step along the path to full `async`/`await`.

Reviewed By: farnz

Differential Revision: D22244489

fbshipit-source-id: b1bcb65a6d9e63bc963d9faf106db61cd507e452
2020-06-30 02:37:34 -07:00
Stanislau Hlebik
04ce32014d mononoke: log pushed commits to scribe
Summary: This is the final diff of the stack - it starts logging pushed commits to scribe

Reviewed By: farnz

Differential Revision: D22212755

fbshipit-source-id: ec09728408468acaeb1c214d43f930faac30899b
2020-06-29 12:15:22 -07:00
Simon Farnsworth
454de31134 Switch Loadable and Storable interfaces to new-style futures
Summary:
Eventually, we want everything to be `async`/`await`; as a stepping stone in that direction, switch some of the blobstore interfaces to new-style `BoxFuture` with a `'static` lifetime.

This does not enable any fixes at this point, but does mean that `.compat()` moves to the places that need old-style futures instead of new. It also means that the work needed to make the transition fully complete is changed from a full conversion to new futures, to simply changing the lifetimes involved and fixing the resulting compile failures.

Reviewed By: krallin

Differential Revision: D22164315

fbshipit-source-id: dc655c36db4711d84d42d1e81b76e5dddd16f59d
2020-06-25 08:45:37 -07:00
Pavel Aslanov
ea79e79538 move all mercurial content generation logic to blobrepo_hg
Summary: Move all mercurial changeset generation logic to `blobrepo_hg`. This is preliminary step is required to decouples BlobRepo from mercurial, and in later stages it will be moved to derived data infra once blobrepo is free of mercurial.

Reviewed By: StanislavGlebik

Differential Revision: D22089677

fbshipit-source-id: bca28dedda499f80899e729e4142e373d8bec0b8
2020-06-22 07:29:19 -07:00
Pavel Aslanov
a1f5e45a5a BlobRepoHg extension trait.
Summary: This diff introduces `BlobRepoHg` extension trait for `BlobRepo` object. Which contains mercurial specific methods that were previously part of `BlobRepo`. This diff also stars moving some of the methods from BlobRepo to BlobRepoHg.

Reviewed By: ikostia

Differential Revision: D21659867

fbshipit-source-id: 1af992915a776f6f6e49b03e4156151741b2fca2
2020-06-22 07:29:19 -07:00
Jeremy Fitzhardinge
1b4edb5567 eden: remove unused Rust dependencies
Summary:
Remove unused dependencies for Rust targets.

This failed to remove the dependencies in eden/scm/edenscmnative/bindings
because of the extra macro layer.

Manual edits (named_deps) and misc output in P133451794

Reviewed By: dtolnay

Differential Revision: D22083498

fbshipit-source-id: 170bbaf3c6d767e52e86152d0f34bf6daa198283
2020-06-17 17:55:03 -07:00
Viet Hung Nguyen
d622ecb06a mononoke/bonsai_git_mapping: add CoreContext to BonsaiGitMapping functions
Summary: Log sql accesses in bonsai_git_mapping: added (core: &CoreContext) arguments to BonsaiGitMapping trait functions. Increment counters in functions where we have sql requests (e.g SQLReadsReplica). Updated tests covering BonsaiGitMapping with mock context object.

Reviewed By: StanislavGlebik

Differential Revision: D22043831

fbshipit-source-id: d05b07e262a8b7494d2ae46d5660d1c0695619ae
2020-06-15 11:23:23 -07:00
Mateusz Kwapich
bc20c35b90 migrate ReachabilityIndex trait to async/await
Reviewed By: StanislavGlebik

Differential Revision: D21958617

fbshipit-source-id: 5acdfdc5e4dd9dc694a32bcf6441fdb4ca0f5776
2020-06-15 08:14:36 -07:00
Mateusz Kwapich
fe0ccc5b08 migrate fetch_skiplist_index to async/await syntax
Reviewed By: StanislavGlebik

Differential Revision: D21955570

fbshipit-source-id: 3d260520618af8c19d1cc3ffe20d73f3c676ed47
2020-06-15 08:14:36 -07:00
Arun Kulshreshtha
63ffc2d838 mononoke_api: add Send + Sync + 'static bounds to HgDataContext and HgDataId
Summary:
Add trait bounds to ensure that implementors of these trait can be
safely used across threads. This is particularly useful when using these traits
in generic async code -- async code typically requires these trait bounds on
data captured in combinator closures, etc.

Reviewed By: krallin

Differential Revision: D22008466

fbshipit-source-id: 48eac59ca62debc9bd293261f6079a4fa134f331
2020-06-12 12:16:51 -07:00
Mark Thomas
d3a02aa301 scs_server: use service_identity for repo_create_commit
Summary:
If the caller provides a service identity in `repo_create_commit`, use that to obtain
write access to the repository.

Reviewed By: StanislavGlebik

Differential Revision: D21995724

fbshipit-source-id: ba218e392b979938d598a37494b0ffe496f28722
2020-06-11 10:44:52 -07:00
Mark Thomas
4b76a1564d mononoke_api: remove legacy functions
Summary: Now that apiserver is gone, we can remove the legacy parts of mononoke_api.

Reviewed By: krallin

Differential Revision: D21976615

fbshipit-source-id: 139d7ebd4a7185693f6a4fe4e5c234c143f18498
2020-06-11 10:44:52 -07:00
Mark Thomas
b0509f5419 mononoke_api: add move_bookmark method
Summary:
Add the `move_bookmark` method to `mononoke_api`.

This attempts to re-use code from `repo_client`.  This code isn't really designed to be called from this API, so the fit is very poor.  In a future diff we will fix this up.

The `repo_client` code for force-moving a bookmark does not support running hooks for that bookmark.  For now we will prevent API users from moving bookmarks that have hooks configured.  This will also be addressed in a future diff.

Reviewed By: krallin

Differential Revision: D21904979

fbshipit-source-id: 42bf840489e5b04f463c69c752bcaa5174630c21
2020-06-11 10:44:51 -07:00
Arun Kulshreshtha
898ddfe519 edenapi_server: add subtree endpoint
Summary:
Add a new `subtree` endpoint to the EdenAPI server, which fetches trees using the underlying server-side logic for the `gettreepack` wire protocol command. This is intended for use in situations where compatibility with `gettreepack` is desired when using HTTP for tree fetching.

The name of the endpoint is up for bikeshedding. It seemed weird to name the endpoint `gettreepack` since that name is a verb and refers to a "pack" which is not relevant in this context (there are no wirepacks or packfiles involved). I chose the name `subtree` since the endpoint logically returns all of the nodes underneath a given node in the tree (though in the most frequent case, the node will be the root node and therefore the subtree will be the entire tree).

In practice, this initial implementation is not ideal because it buffers the trees in memory, which is problematic because `gettreepack` requests are likely to produce a very large number of trees. Later in this stack, the endpoint will be updated to produce a streaming response instead.

Reviewed By: StanislavGlebik

Differential Revision: D21782764

fbshipit-source-id: 726925858352c33c923da1979da9d20fbcf930f6
2020-06-10 19:29:44 -07:00
Mark Thomas
1105b8a9b0 mononoke_api: add service permission checker
Summary:
Add a permission checker that verifies that the user is permitted to make
requests on behalf of a service.  This uses a different ACL than the usual repo
ACL.

Reviewed By: mitrandir77

Differential Revision: D21886531

fbshipit-source-id: bceb63aed12c11ebe2a3d65a2560c014267b0e20
2020-06-10 19:29:32 -07:00
Mark Thomas
2ad3269a29 metaconfig: add types and parser for Source Control Service params
Reviewed By: mitrandir77

Differential Revision: D21886535

fbshipit-source-id: a12e7e8a3d2f70ece13e4fc736acbbf12e79d1e0
2020-06-10 19:29:32 -07:00
Mark Thomas
1b549f73a9 mononoke_api: move create_changeset into its own file
Summary:
The repository write methods are likely to get fairly large.  Move
`create_changeset` to its own module so that we can add future methods as
separate modules.

Reviewed By: mitrandir77

Differential Revision: D21886532

fbshipit-source-id: 08de34a400d056bc97cf6e54856f2a2fd185814c
2020-06-10 19:29:31 -07:00
Lukas Piatkowski
e38fc40b9f mononoke: replace direct usages of ServiceData by dynamic singleton counters
Summary: The replacement will make lfs_server, mononoke_api, edenapi_server and walker OSS buildable.

Reviewed By: krallin

Differential Revision: D21884324

fbshipit-source-id: e6cdf8356b13056a9944ab9da18dc15977b6a2ec
2020-06-10 19:29:19 -07:00
Stanislau Hlebik
4c15790b84 mononoke: return FilenodeResult from get_all_filenodes_maybe_stale
Summary:
Let's return FilenodeResult from get_all_filenodes_maybe_stale and change
callers to deal with that.

The change is straightforward with the exception of `file_history.rs`.
get_all_filenodes_maybe_stale() is used here to prefetch a lot filenodes in one
go. This diff changes it to return an empty vec in case filenodes are disabled.
Unfortunately this is not a great solution - since prefetched files are empty
get_file_history_using_prefetched() falls back to fetching filenodes
sequentially from the blobstore. that might be too slow, and the next diffs in
the stack will address this problem.

Reviewed By: krallin

Differential Revision: D21881082

fbshipit-source-id: a86dfd48a92182381ab56994f6b0f4b14651ea14
2020-06-10 19:29:16 -07:00
David Tolnay
cf412e0d6b rustfmt: Use use_try_shorthand default
Summary:
I observed that for whatever reason our setting of `use_try_shorthand = true` in rustfmt.toml was causing entire functions to not get processed by rustfmt. Even files that contain neither `try` nor `?`. Remove it and reformat fbsource.

Documentation of that config:

- https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#use_try_shorthand

We don't particularly care about the value anymore because nobody writes `r#try!(...)` in 2018 edition code.

Minimized:

```
fn f() {
    g(
        )
        // ...
        .h
}
```

This function gets formatted only if use_try_shorthand is not set.

The bug is fixed in the rustfmt 2.0 release candidate.

Reviewed By: jsgf

Differential Revision: D21878162

fbshipit-source-id: b028673c0eb703984d24bf0d2983453fc2a8c212
2020-06-10 19:29:15 -07:00
Mateusz Kwapich
9085d631e6 add common_base method
Summary: We need to thread it through this layer to get it to SCS

Reviewed By: StanislavGlebik

Differential Revision: D21840078

fbshipit-source-id: d3c16a4afd87aa844628dd0aab7f85b8d38dadf8
2020-06-10 19:29:13 -07:00
Stanislau Hlebik
964832f97e mononoke: rename max_depth to max_legth parameter in get_file_history_using_prefetched
Summary:
The max_depth parameter was confusing - one might have thought that it returns
all entries that are `max_depth` hops away from `startnode`. This is not the
case - in reality it just limits what's the total number of entries can be
returned.
In fact, I think it can be replaced with Stream::take() method, however that's
a larger refactoring, and I'm not going to do it now.

It doesn't matter much because usually we have linear histories, but I think
it's still worth to make it clearer.

Reviewed By: krallin

Differential Revision: D21880220

fbshipit-source-id: d209e1e129383f9181ae11b489992dc4c3ce2d5c
2020-06-04 03:16:22 -07:00
Stanislau Hlebik
7ccd28de14 scs_server: add track_history_across_deletions parameter
Reviewed By: krallin

Differential Revision: D21718738

fbshipit-source-id: b7dd7e05b1773ac1a442d89991549f0f97e1e55b
2020-05-26 05:38:55 -07:00
Thomas Orozco
4e8ac58525 scs: allow globalrev "prefix" lookups
Summary:
This allows us to find the closest globalrev (i.e. the highest that is lower
than or equal to the one being requested). Conceptually, this is similar to
prefix lookups, which is why we're including it in the prefix lookup function
method!

Reviewed By: markbt

Differential Revision: D21553081

fbshipit-source-id: 4b08f7e2478210d406b1a043e95f8768a3dcc45a
2020-05-14 10:20:57 -07:00
Arun Kulshreshtha
2fcf4c4901 mononoke_api: add HgDataContext and HgDataId traits
Summary: In order to allow writing code that is generic over files and trees, move the functionality common between the two to a separate trait. This will allow for a significant amount of code sharing in the EdenAPI server. (This diff does not introduce any new functionality; it's mostly just moving existing code into the new traits.)

Reviewed By: krallin

Differential Revision: D21412988

fbshipit-source-id: 31b55904f62ccb965b0f9425de875fc069e10b5a
2020-05-12 16:26:19 -07:00
Lukas Piatkowski
6ea1603432 mononoke_api: fix for acl check in tests
Summary:
This is a fix after D21067809 broke the mononoke_api unittests and was not caught by sandcastle.

Prior to this change if `ctx.identities` were None then the permission was unconditionally denied, even when the permission checker is set to always_allow. After this change if the identities is None then the permission_checker is called with empty identity set thus making unit tests work properly.

Reviewed By: krallin

Differential Revision: D21324038

fbshipit-source-id: 1edd5fd2af6731d43cab06324b4d9fc02882c09e
2020-04-30 03:14:50 -07:00