Commit Graph

1314 Commits

Author SHA1 Message Date
Arun Kulshreshtha
7144363d2c gotham_ext: move LogMiddleware to gotham_ext
Summary: Now that `LogMiddleware` no longer depends on `RequestContext`, it can be moved into `gotham_ext`.

Reviewed By: DurhamG

Differential Revision: D23298412

fbshipit-source-id: d5288decba98c3dd4605b9a44e41eba0f47fee37
2020-09-03 11:59:31 -07:00
Arun Kulshreshtha
35d292e513 gotham_ext: move LoadMiddleware to gotham_ext
Summary: Now that `LoadMiddleware` no longer depends on `RequestContext`, it can be moved into `gotham_ext`.

Reviewed By: DurhamG

Differential Revision: D23298416

fbshipit-source-id: 5d29da492e39beb5621daf0570d9b3e657cbfc04
2020-09-03 11:59:31 -07:00
Arun Kulshreshtha
82c451fb9f lfs_server: use PostRequestMiddleware
Summary: This diff removes the post-request callback functionality from the LFS server's `RequestContext` and replaces it with the new `PostRequestMiddleware`. The middleware is directly based on `RequestContext`, so the underlying behavior is essentially the same as before.

Reviewed By: krallin

Differential Revision: D23298413

fbshipit-source-id: 1e58a40f6ce6d526456dbd9ae3a8efc85768bf04
2020-09-03 11:59:31 -07:00
Arun Kulshreshtha
3ad7fa8b6f gotham_ext: allow applications to dynamically configure PostRequestMiddleware
Summary: Make `PostRequestMiddleware` generic over a user-provided config struct which can be used to dynamically configure the behavior of post-request callback dispatching. Right now this is only used to support disabling hostname logging, but could be easily extended to cover more uses in the future.

Reviewed By: krallin

Differential Revision: D23495005

fbshipit-source-id: 3d59a8346f449775ec76d03c260d973d04fb90a9
2020-09-03 11:59:31 -07:00
Arun Kulshreshtha
cc0f2e4c40 gotham_ext: add PostRequestMiddleware
Summary: Add new middleware that allows HTTP handlers and other middleware to register callbacks that will be run once the current request completes. This is heavily based on the post-request callback functionality from the LFS server's `RequestContext`. The intention here is to expose this functionality in a manner that's independent of other, application-specific logic.

Reviewed By: krallin

Differential Revision: D23298419

fbshipit-source-id: e4b1534b02c35f685ce544de13e331947e187818
2020-09-03 11:59:31 -07:00
Thomas Orozco
d77cf89ead mononoke/admin: clean up unodes subcommand a bit
Summary:
I pattern matched off of this for the previous diff in this stack, and spotted
a bit of clean up that might make sense here:

- Using `.help()` for a subcommand overrides the whole help text. We meant to
  use `.about()` here. I fixed this in some copy-pasted code as well.
- Printing debug output alongside real output makes it harder to select the
  real output. I fixed this by logging debug output to stderr instead.

Reviewed By: StanislavGlebik

Differential Revision: D23471560

fbshipit-source-id: 7900cfe65613c48abd77faad6d6a45a7aa523b36
2020-09-03 09:32:06 -07:00
Thomas Orozco
179e4eb80e mononoke/admin: add a subcommand for dumping paths
Summary:
This adds a subcommand for dumping all the paths in a repository. This is
helpful when you have a Content ID, limited imagination and time on your hands,
and you'd like to turn those into a file path where that Content ID lives.

This uses fsnodes for the traversal because that's O(# directories) as opposed
top O(# files). I had an earlier implementation that used unodes, but that was
really slow.

Reviewed By: StanislavGlebik

Differential Revision: D23471561

fbshipit-source-id: 948bfd20939adf4de0fb1e4b2852ad4d12182f16
2020-09-03 09:32:06 -07:00
Viet Hung Nguyen
7c34b39ec8 mononoke/repo_import: add backsyncing to rewrite file paths, remove backup file
Summary:
add backsyncing to rewrite file paths:
After setting the variables for large repo (D23294833 (d6895d837d)), we try to import the git commits into large repo and rewrite the file paths.
Following this, repo import tool should back-sync the commits into small_repo.

next step: derive all the data types for both small and large repos. Currently, we only derive it for the large repo.

==============
remove backup file:
The backup file was a last-minute addition when trying to import a repo for the first time.
Removed it, because we shouldn't write to external files. Future plan is to include
better process recoverability across the whole tool and not just rewrite file paths functionality.

Reviewed By: StanislavGlebik

Differential Revision: D23452571

fbshipit-source-id: bda39694fa34788218be795319dbbfd014ba85ff
2020-09-03 06:43:08 -07:00
Stanislau Hlebik
a77d9f243a mononoke: parallelize operations in create_commit scs method
Reviewed By: krallin

Differential Revision: D23496535

fbshipit-source-id: 18f88abb9b85d38a93d2aa99c38edcf8190343c3
2020-09-03 04:12:35 -07:00
Lukas Piatkowski
a4af730541 monononke/hooks: make no_bad_filenames public
Reviewed By: aslpavel

Differential Revision: D23474524

fbshipit-source-id: 5f7826346500b1acc7450791dd1e7806c4e623d6
2020-09-03 02:40:43 -07:00
Lukas Piatkowski
81d9338100 mononoke/hooks: make few generic hooks public
Summary: More hooks will come in next diffs.

Reviewed By: aslpavel

Differential Revision: D23449755

fbshipit-source-id: 451fdb7a759140f2d6df8f3a18493c700fa2b761
2020-09-03 02:40:43 -07:00
Stanislau Hlebik
29bbc0dc15 mononoke: check if content we are about to redact is not reachable
Summary:
That's one of the sev followups. Before redacting a file content let's check if
it exists in "main-bookmark" (which is be default master), and refuse to redact
if it actually exists.

If this check passes (i.e. the content we are about to redact is not reachable
from master) that doesn't mean that we are 100% safe. E.g. this comment can be
in ancestor of master, or in any other repo or it can be added in the next
commit.

This check is a best-effort check to prevent shooting ourselves in the foot.

Reviewed By: aslpavel

Differential Revision: D23476278

fbshipit-source-id: 5a4cd10964a65b8503ba9a6391f17319f0ce37d8
2020-09-03 01:30:14 -07:00
Stefan Filip
da4c33c67a tests: add commit-location-to-hash integration test
Summary: Exercise location-to-hash functionality in edenapi.

Reviewed By: kulshrax

Differential Revision: D23456214

fbshipit-source-id: 2ab22eb045517a5927c2de502d8cfc9898daecef
2020-09-02 17:20:43 -07:00
Stefan Filip
932450fb15 handlers: update location-to-hash endpoint with count parameter
Summary:
To reduce the size over the wire on cases where we would be traversing the
changelog on the client, we want to allow the endpoint to return a whole parent
chain with their hashes.

Reviewed By: kulshrax

Differential Revision: D23456216

fbshipit-source-id: d048462fa8415d0466dd8e814144347df7a3452a
2020-09-02 17:20:42 -07:00
Stefan Filip
7122cdded7 types: rename Location to CommitLocation
Summary:
Renaming all the LocationToHash related structures to CommitLocationToHash.
This is done for consistency. I realized the issue when the command for reading
the request from cbor was not what I was expecting it to be. The reason was that
the commit prefix was used inconsistently for LocationToHash.

Reviewed By: kulshrax

Differential Revision: D23456221

fbshipit-source-id: 0181dcaf81368b978902d8ca79c5405838e4b184
2020-09-02 17:20:42 -07:00
Stefan Filip
310b3616a6 blobrepo: instantiate segmented changelog as an attribute
Summary:
Segmented Changelog is a component that has multiple components of each own
that each can be configured in different ways. It seems that it already is
more complicated than other components in how it is set up and it will probably
evolve to have more knobs (caching comes to mind).

Right now we have 3 ways of instantiating SegmentedChangelog:
- Disabled, all requests return errors
- ReadOnly, requests to unprocessed commits return errors
- OnDemandUpdate, requests trigger commit processing when required

Reviewed By: aslpavel

Differential Revision: D23456217

fbshipit-source-id: a6016f05197abbc3722764fa8e9056190a767b36
2020-09-02 17:20:42 -07:00
Stefan Filip
b818a86631 config: add segmented changelog config parsing
Summary:
Parsing is done in the SegmentedChangelogConfig structure which will inform
how to construct the SegmentedChangelog in Mononoke.

Reviewed By: aslpavel

Differential Revision: D23456222

fbshipit-source-id: a7d5d81f4c166909164026e81af57f1c2ea32347
2020-09-02 17:20:42 -07:00
Stefan Filip
e57b1f9265 segmented_changelog: add on-demand updating dag implementation
Summary:
The Segmented Changelog must be built somewhere. One of the simplest deployments
of involves the on-demand update of the graph. When a commit that wasn't yet
processed is encountered, we sent it to processing along with all of it's
ancestors.

At this time not much attention was paid to the distinction of master commit
versus non-master commit. For now the expectation is that only commits from
master will exercise this code path. The current expectation is that clients
will only call location-to-hash using commits from master.
Let me know if there is an easy way to check if a commit is part of master.
Later changes will invest more in handling non-master commits.

Reviewed By: aslpavel

Differential Revision: D23456218

fbshipit-source-id: 28c70f589cdd13d08b83928c1968372b758c81ad
2020-09-02 17:20:42 -07:00
Stefan Filip
d50e09a41d segmented_changelog: add SegmentedChangelogBuilder
Summary:
This builders implements SqlConstruct and SqlConstuctFromMetadataDatabaseConfig
to make handling the Sql connection for IdMap consistent with what happens in
Mononoke in general.

Reviewed By: aslpavel

Differential Revision: D23456219

fbshipit-source-id: 6998afbbfaf1e0690a40be6e706aca1a3b47829f
2020-09-02 17:20:42 -07:00
Stefan Filip
66706d77c5 segmented_changelog: add SegmentedChangelog trait
Summary:
The trait provides two methods for location to hash translation. The first
returns a single hash and is existing functionality. The second returns a
list of hashes and represents new functionality. This diff also adds this
functionality to the Dag structure which is currently the only real
implementation for SegmentedChangelog.

Reviewed By: aslpavel

Differential Revision: D23456215

fbshipit-source-id: 0c2ca91672cf23129342c585f98446c0ebbdf7ef
2020-09-02 17:20:41 -07:00
Stefan Filip
10b233f180 blobrepo: move ChangesetFetcher to attributes
Summary:
I am planning to add Segmented Changelog to attributes.

I am writing an integration test for an EdenApi endpoint that depends on
Segmented Changelog and I would like to set it up to update on demand. When a
request comes in for a commit that we haven't parsed for Segmented Changelog we
want to update the structure on demand. This means that we probably need to
fetch commits. This means that we want to pass the ChangesetFetcher to Segmented
Changelog when it is built. Since Segmented Changelog fits well as an attribute
we want the ChangesetFetcher as an attribute.

I wonder how much thought has been given to attributes behaving as a dependency
injector in the `guice` sense.

Reviewed By: aslpavel

Differential Revision: D23428201

fbshipit-source-id: 7003c018ba806fd657dd8f071e0e83d35058b10f
2020-09-02 17:20:41 -07:00
Kostia Balytskyi
6e8cbd31b1 megarepotool: add gradual-merge-progress subcommand
Summary:
This is to be able to automatically report progress: how many merges has been
done already.

Note: this intentionally uses the same logic as regular `gradual-merge`, so that we always report correct numbers.

Reviewed By: StanislavGlebik

Differential Revision: D23478448

fbshipit-source-id: 3deb081ab99ad34dbdac1057682096b8faebca41
2020-09-02 12:18:31 -07:00
Thomas Orozco
b8e197fdb4 mononoke/lfs_server: allow enabling rate limits probabilistically
Summary:
If we exceed a rate limit, we probably don't want to just drop 100% of traffic.
This would create a sawtooth pattern where we allow a bunch of traffic, update
our counters, drop a bunch of traffic, update our counters again, allow a bunch
of traffic, etc.

To fix this, let's make limits probabilistic. This lets us say "beyond X GB/s,
drop Y% of traffic", which is closer to a sane rate limit.

It might also make sense to eventually change this to use ratelim. Initially,
we didn't do this because we needed our rate limiting decisions to be local to
a single host (because different hosts served different traffic), but now that
we spread the load for popular blobs across the whole tier, we should be able
to just delegate to ratelim.

For now, however, let's finish this bit of a functionality so we can turn it
on.

The corresponding Configerator change is here: D23472683

Reviewed By: aslpavel

Differential Revision: D23472945

fbshipit-source-id: f7d985fded3cdbbcea3bc8cef405224ff5426a25
2020-09-02 11:02:18 -07:00
Stanislau Hlebik
cdf96a20dd mononoke: asyncify redaction_add
Summary: Will change it in the next diff, so let's asyncify it now.

Reviewed By: aslpavel

Differential Revision: D23475332

fbshipit-source-id: f25fb7dc16f99cb140df9374f435e071401c2b90
2020-09-02 09:28:48 -07:00
Alex Hornby
b22599c500 mononoke: memo the hash values of interned paths in the walker
Summary: Memo the hash values of interned paths in the walker. The interner calls the hash function inside a lock that gets heavily contended, so this reduces the time the lock is held.

Reviewed By: farnz

Differential Revision: D23075260

fbshipit-source-id: 3ee50e3ce56106eadd17dc7d737ba95282640051
2020-09-02 05:52:33 -07:00
Alex Hornby
46cc110012 mononoke: switch walker from arc-intern to internment
Summary: Switch the walker from arc-intern::ArcIntern to internment::ArcIntern as internment does not need to acquire its map's locks on every drop.

Reviewed By: farnz

Differential Revision: D23075265

fbshipit-source-id: 6dd241aed850ec0fd3c8a4e68dda06053ec0b424
2020-09-02 05:52:33 -07:00
Kostia Balytskyi
d49406d847 repo_client: get rid of unneeded perf counters
Summary:
These two perf counters proved to be not very convenient to evaluate the
volume of undesired file fetches. Let's get rid of them. Specifically, they are
not convenient, because they accumulate values and it's hard to aggregate over
them.

Note that I don't do the same for tree fetches, as there's no better way of
estimating those now.

Reviewed By: mitrandir77

Differential Revision: D23452913

fbshipit-source-id: 08f8dd25eece495f986dc912a302ab3109662478
2020-09-02 05:02:46 -07:00
Kostia Balytskyi
e7ddc6cc13 undesired fetches: regex-based reporting
Summary:
We want to be able to report more than just on one prefix. Instead, let's add a regex-based reporting. To make deployment easier, let's keep both options for now and later just remove prefix-based one.

Note: this diff also changes how a situation with absent `undesired_path_prefix_to_log` is treated. Previously, if `undesired_path_prefix_to_log` is absent, but `"undesired_path_repo_name_to_log": "fbsource"`, it would report every path. Now it won't report any, which I think is a saner behavior. If we do ever want to report every path, we can just add `.*` as a regex.

Reviewed By: StanislavGlebik

Differential Revision: D23447800

fbshipit-source-id: 059109b44256f5703843625b7ab725a243a13056
2020-09-01 12:01:00 -07:00
Viet Hung Nguyen
2c1d4a49ad mononoke/repo_import: change logic of file paths rewriting with multiple movers
Summary:
This diff modifies how we rewrite file paths when we import into a repo by allowing the tool to apply multiple movers.

Motivation:
When we try to import into a small repo that pushredirects to a large repo, we have decided to import into the large repo first, then backsync to the small repo. To do that, we have to set a couple of flags related to importing into the large repo (see: D23294833 (d6895d837d)): bookmarks and import destination path.  Previously, we fixed the destination path in large repo by applying the small_to_large repo syncer's mover on the destination path in small repo. e.g:
if small_to_large repo syncer mover = {
default_action = prepend(**large_dir**)
map = [...]},
then **destination_path** in small repo becomes **large_dir/destination_path** in large repo.
After this, we prepended the imported files with the new prefix with another mover: prepend(**large_dir/dest_path**)
a -> large_dir/dest_path/a
Consequently, all directories and files under **destination_path** would get imported under **large_dir/destination_path** in large repo with this logic. e.g.
However, it's possible that with push-redirections, some directories would get remapped to a different place in large repo. e.g
small_to_large syncer mover = {
default_action = prepend(**large_dir**)
map = [
dest_path/b -> random_dir/b
]},
but with the current repo_import implementation dest_path/b would get prepended to large_dir/dest_path/b.
To avoid this, we apply multiple movers on the imported files. e.g.
1. we prepend all files with dest_path:
    mover = {
    default_action: prepend(**dest_path**)
    map={}} =>
    a -> dest_path/a
    b -> dest_path/b
2. we remap the files using the small_to_large repo syncer mover:
    mover = {
 default_action: prepend(**large_dir**)
 map =
 {dest_path/b -> random_dir/b}} =>
   dest_path/a -> large_dir/dest_path/a
   dest_path/b -> random_dir/b

Reviewed By: StanislavGlebik

Differential Revision: D23371244

fbshipit-source-id: 0bf4193b24d73c79ed00dfb38e2b0538388d1c0f
2020-09-01 09:26:07 -07:00
Pavel Aslanov
fffcf5b966 utility to keep streaming clone data warm
Summary: This is streaming clone warmup binary as per https://fb.quip.com/hfuBAdYnzr9M

Reviewed By: StanislavGlebik

Differential Revision: D23347029

fbshipit-source-id: f187a2f3529a7eae5998bab199228bfbe6057e6e
2020-09-01 07:13:33 -07:00
David Tolnay
75c2118e01 Remove crate_root from Rust dependency info
Reviewed By: danobi

Differential Revision: D23430948

fbshipit-source-id: c4b374021325fc247121ceecd0e82a0291aa75d6
2020-08-31 14:43:24 -07:00
Arun Kulshreshtha
767570d298 lfs_server: remove PerfCounters from post-request callback signature
Summary:
`PerfCounters` was the only application-specific type exposed as a parameter to the post-request callbacks, and it was only being used in one place. To facilitate making the post-request callback functionality more general, this diff makes the callback in question capture the `CoreContext` in its environment, thereby giving it access to the `PerfCounters` without requiring it to be passed as an argument.

This should not change the behavior since regardless of how the callback obtains a reference, it will still refer to the same underlying `PerfCounters` from the request's `CoreContext`.

Reviewed By: DurhamG

Differential Revision: D23298417

fbshipit-source-id: 898f14e5b35b827e98eaf1731db436261baa43bb
2020-08-27 14:15:25 -07:00
Durham Goode
fe56f44ca0 treemanifest: prevent fetching nullid
Summary:
Mononoke throws an error if we request the nullid. In the long term we
want to get rid of the concept of the nullid entirely, so let's just add some
Python level blocks to prevent us from attempting to fetch it. This way we can
start to limit how much Rust has to know about these concepts.

Reviewed By: sfilipco

Differential Revision: D23332359

fbshipit-source-id: 8a67703ba1197ead00d4984411f7ae0325612605
2020-08-27 09:59:40 -07:00
Viet Hung Nguyen
d6895d837d mononoke/repo_import: generate repo import settings for push-redirected repo
Summary:
Once we discover that the (small) repo we import into push-redirects (D23158826 (d3f3cffe13)) to a large repo,
we want to import into the large repo first, then backsync into the small one (see previous diff summary).
The aim of this diff is to setup the variables (e.g. bookmarks) needed for importing into
the large repo first before backsyncing the commits into the small repo.

Next step: add functionalities to control how we backsync from large repo to the small repo

Reviewed By: StanislavGlebik

Differential Revision: D23294833

fbshipit-source-id: 019d84498fae4772051520754991cb59ea33dbf4
2020-08-27 02:38:26 -07:00
Stefan Filip
902bdfd46a tests: set --noproxy localhost for all sslcurl calls
Summary:
Without the `--noproxy localhost` flag curl will obey the `https_proxy` env
variable but will not respect the `no_proxy` env variable or `curlrc`.
This means that tests running in a shell with `https_proxy` will likely fail.
The failures may vary in aspect based on what logic is running at the time.

Reviewed By: kulshrax

Differential Revision: D23360744

fbshipit-source-id: 0383a141e848bd2257438697e699f727d79dd5d2
2020-08-26 18:40:52 -07:00
Arun Kulshreshtha
9f68c673f3 gotham_ext: move TimerMiddleware into gotham_ext
Summary: Now that `TimerMiddleware` no longer depends on `RequestContext`, it can be moved into `gotham_ext`.

Reviewed By: farnz

Differential Revision: D23298414

fbshipit-source-id: 058cb67c9294b28ec7aec03a45da9588e97facc5
2020-08-26 16:04:31 -07:00
Arun Kulshreshtha
825016043f lfs_server: decouple TimerMiddleware from RequestContext
Summary: Previously, the LFS server's `TimerMiddleware` needed to be used in conjunction with `RequestContext`, as its purpose was to simply call a method on the `RequestContext` to record the elapsed time. This diff moves tracking of the elapsed time into `TimerMiddleware` itself (via Gotham's `State`), allowing the middleware to be used on its own.

Reviewed By: farnz

Differential Revision: D23298418

fbshipit-source-id: 8077d40edec0936d95317ac11d86bbcd33a3bf04
2020-08-26 16:04:31 -07:00
Stanislau Hlebik
7cfbf99de4 mononoke: add admin command to find rejected blames
Summary:
We might need to rebackfill blame for configerator (see
https://fburl.com/hfylxmag). It's good to have a command that shows how many
files with rejected blame we have.

Reviewed By: farnz

Differential Revision: D23267648

fbshipit-source-id: 33e658b53391285461890bda3a94b391e6063c12
2020-08-26 11:54:08 -07:00
Arun Kulshreshtha
c08f67f004 gotham_ext: move middleware.rs to middleware/mod.rs
Summary: Move `middleware.rs` to `middleware/mod.rs` for consistency with the prevailing module file structure in the Mononoke codebase.

Reviewed By: sfilipco

Differential Revision: D23298420

fbshipit-source-id: 4f88d046a2c6ca1be2e3e315c9eea17845c6b8b3
2020-08-25 17:33:42 -07:00
Arun Kulshreshtha
374eb7d1bf edenapi_server: remove extract_identities function
Summary: This function used to be longer before AclChecker was replaced with PermissionsChecker. Now the function is a one-liner, so it doesn't make sense to keep it as a separate function.

Reviewed By: sfilipco

Differential Revision: D23304899

fbshipit-source-id: 23e8c4b2334cdbff21ca336aecedf6ba6c466f99
2020-08-25 17:18:49 -07:00
Mark Thomas
dee916ec4c bookmarks_movement: handle services with all or no permitted paths
Summary:
If a service is configured with no permitted paths, ensure we deny any writes
that might affect any path.  This is not hugely useful, and probably means a
configuration error, but it's the safe choice.

In a similar vein, if a service is permitted to modify any path, there's not
much point in checking all the commits, so skip the path checks to save some
time.

Reviewed By: StanislavGlebik

Differential Revision: D23316392

fbshipit-source-id: 3d9bf034ce496540ddc4468b7128657e446059c6
2020-08-25 09:14:09 -07:00
Mark Thomas
f15976637e bookmarks_movement: restrict bookmarks that are marked allow_only_external_sync
Reviewed By: StanislavGlebik

Differential Revision: D23294907

fbshipit-source-id: ed89e5fd841e7d516b5d259c1f5de4e9f8f40ee3
2020-08-25 09:14:09 -07:00
Mark Thomas
eed7df1c52 bookmarks_movement: add integration test for bookmark modifications
Summary:
This tests creating, moving and deleting bookmarks using the source control
service, making sure that hooks and service write restrictions are applied
appropriately.

Reviewed By: StanislavGlebik

Differential Revision: D23287999

fbshipit-source-id: bd7e66ec3668400a617f496611e4f24f33f8083e
2020-08-25 09:14:09 -07:00
Mark Thomas
f474c09d90 scs_server: implement repo_create_bookmark and repo_delete_bookmark
Summary: Implement these new thrift methods by calling the corresponding mononoke_api method.

Reviewed By: StanislavGlebik

Differential Revision: D23288002

fbshipit-source-id: 2abf1144fe524f695984a7aa472308b8bf067d45
2020-08-25 09:14:09 -07:00
Mark Thomas
4747346e82 mononoke_api: add create and delete bookmark methods
Summary: Add methods to create and delete bookmarks.

Reviewed By: StanislavGlebik

Differential Revision: D23288003

fbshipit-source-id: 5fca60254f00966478270e1a4447cc6a1b5a438e
2020-08-25 09:14:09 -07:00
Mark Thomas
c3070381b3 bookmarks_movement: implement service write path restrictions
Summary:
Use `PrefixTrie` to ensure that all service writes are to paths that are permitted
for the service.

By default, no paths are permitted.  The service can be configured to allow all
paths by configuring the empty path as a permitted prefix.

Reviewed By: StanislavGlebik

Differential Revision: D23287997

fbshipit-source-id: 2b7a0df655084385f73551602d6107411d6aad2f
2020-08-25 09:14:09 -07:00
Mark Thomas
d7dcd5c4c3 mononoke_types: add PrefixTrie for testing path prefixes
Summary:
Add `PrefixTrie`, which is a collection of path prefixes for testing against.

The tree is initially populated with a set of path prefixes.  Once populated,
it can be tested against using other paths.  These tests will return true if
the trie contains a prefix of that path.

Reviewed By: StanislavGlebik

Differential Revision: D23288127

fbshipit-source-id: 6096a9abc8e3a1bf5a8309123a46d321d9795f77
2020-08-25 09:14:08 -07:00
Mark Thomas
a11e0052ac bookmarks_movement: implement service write bookmark restrictions
Summary:
Move handling of service write bookmark restrictions into the `bookmarks_movement` crate.

This moves `check_bookmark_modification_permitted` from `mononoke_api` onto
`SourceControlServiceParams`, where it can be called from `bookmarks_movement`.

Reviewed By: StanislavGlebik

Differential Revision: D23288000

fbshipit-source-id: e346231b183ce1533ab03130fd2ddab709176fcd
2020-08-25 09:14:08 -07:00
Mark Thomas
111bec050d bookmarks_movement: move hook running to a restrictions enum
Summary:
Bookmark movement for service write will use different restrictions than hooks.
Move hook running to be controlled by an enum in preparation for adding service
write restrictions.

Reviewed By: StanislavGlebik

Differential Revision: D23287998

fbshipit-source-id: 30670d4d6666c341885b57a3f41246e52db541a2
2020-08-25 09:14:08 -07:00
Mark Thomas
0606b32fbe mononoke_api: use bookmarks_movement for repo_move_bookmark
Summary: Use bookmarks_movement to implement the bookmark move in repo_move_bookmark.

Reviewed By: StanislavGlebik

Differential Revision: D23222562

fbshipit-source-id: 31249411d9521823f90248f459eb34ed4e2faea5
2020-08-25 09:14:08 -07:00