Commit Graph

477 Commits

Author SHA1 Message Date
Liubov Dmitrieva
04d32019fa edeapi: clean up usage of callback or progress in the new code.
Summary:
Clean up usage of callback or progress in the new code.

There is no need to use a callback or progress. They were used for legacy progress support. The new progress bar automatically applies to every HTTP request.

Reviewed By: yancouto

Differential Revision: D29710912

fbshipit-source-id: 33889d89680c90e63f4520626a166d0b39b67afb
2021-07-15 06:31:42 -07:00
Meyer Jacobs
64f3872a59 revisionstore: unify "store type" (local vs. shared/cache) enums
Summary:
We have a variety of enums in revisionstore that all serve the same purpose. With this change, I've consolidated them to a single type.

Not 100% sure if `StoreType` is the best name, in scmstore I named it `LocalStoreType` to be more clear - open to suggestions. I also decided to keep the variants named `Local` and `Shared` instead of adopting the `Local` and `Cache` terminology I used in scmstore - I'd rather not change that unless we decide to change the terminology everywhere to avoid confusion.

Reviewed By: kulshrax

Differential Revision: D29598025

fbshipit-source-id: 76d5a02230a8c1e5327cc5d90bbcae70049f251d
2021-07-13 15:17:30 -07:00
Meyer Jacobs
57a0164e8c scmstore: introduce per-backend filescmstore metrics
Summary:
Introduce a basic implementation of per-backend metrics collection for `FileStore`.

Currently, only indexedlog, lfs, and contentstore backends are instrumented, and only with basic metrics. Additional metrics (size, elapsed time, lfs pointer hits) and additional backends (aux, edenapi, lfs server) will be added in a later change.

Reviewed By: kulshrax

Differential Revision: D29552888

fbshipit-source-id: 54267f4de6f14db046cfae271b5c25a6bb494d7c
2021-07-13 15:17:30 -07:00
Liubov Dmitrieva
990a246aa8 Support exchange of mutation information during changesets uploads
Summary:
Support exchange of mutation information during changesets uploads

Add new api for mutation information.

Add implementation for this new api.

Add client side support.

Reviewed By: markbt

Differential Revision: D29661255

fbshipit-source-id: 1d8cfa356599c215460aee49dd0c78b11af987b8
2021-07-13 01:56:06 -07:00
Liubov Dmitrieva
43187d53ad edenapi: Implement uploading changesets in hg cloud upload command
Summary:
Implement using of uploading changesets in `hg cloud upload` command.

This is the last part for `hg cloud upload` - uploading changesets via Edenapi
test
```

```
# machine #2
liubovd {emoji:1f352}  ~/fbsource
 [15] → hg pull -r 0b6075b4bda143d5212c1525323fb285d96a1afb
pulling from mononoke://mononoke.c2p.facebook.net/fbsource
connected to twshared27150.03.cln3.facebook.com session RaIPDgvF6l8rmXkA
abort: 0b6075b4bda143d5212c1525323fb285d96a1afb not found!
```

```
# machine #1
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [6] →  EDENSCM_LOG="edenapi::client=info" ./hg cloud upload
Jul 11 13:26:26.322  INFO edenapi::client: Requesting lookup for 1 item(s)
commitcloud: head '0b6075b4bda1' hasn't been uploaded yet
Jul 11 13:26:26.472  INFO edenapi::client: Requesting lookup for 6 item(s)
commitcloud: queue 1 commit for upload
Jul 11 13:26:26.648  INFO edenapi::client: Requesting lookup for 1 item(s)
commitcloud: queue 0 files for upload
Jul 11 13:26:26.698  INFO edenapi::client: Requesting lookup for 4 item(s)
commitcloud: queue 4 trees for upload
Jul 11 13:26:27.393  INFO edenapi::client: Requesting trees upload for 4 item(s)
commitcloud: uploaded 4 trees
commitcloud: uploading commit '0b6075b4bda143d5212c1525323fb285d96a1afb'...
Jul 11 13:26:28.426  INFO edenapi::client: Requesting changesets upload for 1 item(s)
commitcloud: uploaded 1 commit
```

```
# machine #2
liubovd {emoji:1f352}  ~/fbsource
 [16] → hg pull -r 0b6075b4bda143d5212c1525323fb285d96a1afb
pulling from mononoke://mononoke.c2p.facebook.net/fbsource
connected to twshared16001.08.cln2.facebook.com session QCpy1x9yrflRF6xF
searching for changes
adding commits
adding manifests
adding file changes
added 895 commits with 0 changes to 0 files
(running background incremental repack)
prefetching trees for 4 commits

liubovd {emoji:1f352}  ~/fbsource
 [17] → hg up 0b6075b4bda143d5212c1525323fb285d96a1afb
warning: watchman has recently started (pid 93231) - operation will be slower than usual
connected to twshared32054.08.cln2.facebook.com session Hw91G8kRYzt4c5BV
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

liubovd {emoji:1f352}  ~/fbsource
 [18] → hg diff -c .
connected to twshared0965.07.cln2.facebook.com session rrYSvRM6pnBYZ2Fn
 diff --git a/fbcode/eden/scm/test b/fbcode/eden/scm/test
new file mode 100644
 --- /dev/null
+++ b/fbcode/eden/scm/test
@@ -0,0 +1,1 @@
+test
```

Initial perf wins:

Having a large stack of 6 commits (total 24 files changed), tested *adding a single line to a file at the top commit*. We can see at least 2X win but it should be more because I have tested with a local instance of edenapi service that runs on my devserver.

```
╷
╷ @  5582fc8ee  6 minutes ago  liubovd
╷ │  test
╷ │
╷ o  d55f9bb65  86 minutes ago  liubovd  D29644738
╷ │  [hg] edenapi: Implement using of uploading changesets in `hg cloud upload` command
╷ │
╷ o  561149783  Friday at 15:10  liubovd  D29644797
╷ │  [hg] edenapi: Add request handler for uploading hg changesets
╷ │
╷ o  c3dda964a  Friday at 15:10  liubovd  D29644800
╷ │  [edenapi_service] Add new /:repo/upload/changesets endpoint
╷ │
╷ o  28ce2fa0c  Friday at 15:10  liubovd  D29644799
╷ │  [hg] edenapi/edenapi_service: Add new API for uploading Hg Changesets
╷ │
╷ o  13325b361  Yesterday at 15:23  liubovd  D29644798
╭─╯  [edenapi_service] Implement uploading of hg changesets
```

```
# adding new line to a file test in the test commit, and then run:
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [8] → time hg cloud upload
commitcloud: head '4e4f947d73e6' hasn't been uploaded yet
commitcloud: queue 1 commit for upload
commitcloud: queue 0 files for upload
commitcloud: queue 4 trees for upload
commitcloud: uploaded 4 trees
commitcloud: uploading commit '4e4f947d73e676b63df7c90c4e707d38e6d0a93b'...
commitcloud: uploaded 1 commit

real	0m3.778s
user	0m0.017s
sys	0m0.027s
```

```
# adding another new line to a file test in the test commit, and then run:
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [11] → time hg cloud backup
connected to twshared30574.02.cln2.facebook.com session uvOvhxtBfeM7pMgl
backing up stack rooted at 13325b3612d2
commitcloud: backed up 1 commit

real	0m7.507s
user	0m0.013s
sys	0m0.030s
```

Test force mode of the new command that reupload everything:
```
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [13] → time hg cloud upload --force
commitcloud: head '5582fc8ee382' hasn't been uploaded yet
commitcloud: queue 6 commits for upload
commitcloud: queue 24 files for upload
commitcloud: uploaded 24 files
commitcloud: queue 61 trees for upload
commitcloud: uploaded 61 trees
commitcloud: uploading commit '13325b3612d20c176923d1aab8a28383cea2ba9a'...
commitcloud: uploading commit '28ce2fa0c6a02de57cdc732db742fd5c8f2611ad'...
commitcloud: uploading commit 'c3dda964a71b65f01fc4ccadc9429ee887ea982c'...
commitcloud: uploading commit '561149783e2fb5916378fe27757dcc2077049f8c'...
commitcloud: uploading commit 'd55f9bb65a0829b1731baa686cb8a6e0c5500cc2'...
commitcloud: uploading commit '5582fc8ee382c4c367a057db2a1781377bf55ba4'...
commitcloud: uploaded 6 commits

real	0m7.830s
user	0m0.011s
sys	0m0.032s
```

We can see the time is similar to the current `hg cloud backup` command.

Reviewed By: markbt

Differential Revision: D29644738

fbshipit-source-id: cbbfcb2e8018f83f323f447848b3b6045baf47c5
2021-07-12 02:13:31 -07:00
Liubov Dmitrieva
7105c6e7c1 Back out "Revert D29586388: [hg] edenapi: upload trees client side API"
Summary:
Original commit changeset: 53d067bc2bb9

Same as https://www.internalfb.com/diff/D29586388 (0be0a68cca).

D29586388 (0be0a68cca) was disconnected from its parent and landed too early by mistake and reverted (because it wouldn't even compile without the parent commit).

This is just another version for the D29586388 (0be0a68cca) as it's not possible to reopen the original one.

Reviewed By: markbt

Differential Revision: D29598758

fbshipit-source-id: 96b6137366e196f9cd3c35c178eaa3d2fce1e071
2021-07-09 03:23:45 -07:00
Liubov Dmitrieva
e652bd106a Revert D29586388: edenapi: upload trees client side API
Differential Revision:
D29586388 (0be0a68cca)

Original commit changeset: 73c549f1a0d4

fbshipit-source-id: 53d067bc2bb949945394aa75851e8e93176cd4e2
2021-07-07 14:23:40 -07:00
Liubov Dmitrieva
0be0a68cca edenapi: upload trees client side API
Summary:
Add new client side API for upload trees.

Before uploading them, check what is already present on the server, similar as we check for filenodes.

I also added --force flag for the `hg cloud upload` command. It should be useful in general and useful for testing.

Reviewed By: markbt

Differential Revision: D29586388

fbshipit-source-id: 73c549f1a0d4328a64a133ab508fb4d253a4c33d
2021-07-07 14:04:33 -07:00
Liubov Dmitrieva
d327996144 edenapi: upload filenodes (client side)
Summary:
upload filenodes (client side)

On the client side I implemented file upload and filenodes upload in the same API repo.edenapi.uploadfiles

This is because we should use the tokens from the file upload part to feed then into filenodes upload request.

Reviewed By: markbt

Differential Revision: D29549091

fbshipit-source-id: 436de187c8dce9a603c0c0a182e88b582a2d8001
2021-07-07 11:31:05 -07:00
Jun Wu
8bc4d6e3fb cpython-ext: rename pycell to PyCell
Summary:
cpython-ext is not part of hg business APIs. It does not need to be consistent
with lower-case class name (and hg codebase is okay with non-lowercase class names,
just that most classes there are lower-case).

This resolves a rustc warning about the struct name.

Reviewed By: kulshrax

Differential Revision: D29526579

fbshipit-source-id: a4bc8e788d55c65aae9eaa87e2c684c2fded7ae2
2021-07-06 13:16:10 -07:00
Jun Wu
80714c8647 lib: remove most rustc warnings
Summary: The warnings make build output less clean.

Reviewed By: kulshrax

Differential Revision: D29526580

fbshipit-source-id: eb4069c2edd111bb04b8754e7051035b8aa8a508
2021-07-01 18:08:55 -07:00
Andrey Chursin
7ad57c10a5 bindings: use pycell instead of mincode for pull data
Reviewed By: quark-zju

Differential Revision: D29474445

fbshipit-source-id: dd6536bdbac6e5690c918a222bf3823537ceffcc
2021-07-01 10:49:01 -07:00
Durham Goode
d41c23f862 treemanifest: remove explicit edenapi fetching
Summary:
Since we pass edenapi to the contentstore, it should be doing the http
fetching internally. Let's get rid of the http fetching from the python logic
then.

Once we're 100% on edenapi, this will let us just delete the remotetreestore
entirely.

Reviewed By: quark-zju

Differential Revision: D29167443

fbshipit-source-id: fe1c4d7aae38135bdebf41a39c8beec34153e60e
2021-07-01 09:31:16 -07:00
Meyer Jacobs
4cff0b4160 scmstore: update remaining contentstore binding sites
Summary:
Eliminate remaining uses of `contentstore` directly in the Python bindings.

Add repack functionality to `LegacyStore`.

Implement repack methods on `FileStore` by calling into contentstore fallback if possible, otherwise directly.

Reviewed By: kulshrax

Differential Revision: D29469901

fbshipit-source-id: 5cd134d25680bb55b4ddbe1f6d69e02af8942b16
2021-06-30 10:38:04 -07:00
Andrey Chursin
3a52389401 pydag: expose commits and segments in pullfastforwardmaster
Reviewed By: quark-zju

Differential Revision: D29467413

fbshipit-source-id: 4e7609b23111230fa771a91f7d2d9c27dd12f15c
2021-06-29 19:32:53 -07:00
Jun Wu
a9e414b833 dag: add an API to obtain the master group
Summary: Will be used by the next change.

Reviewed By: andll

Differential Revision: D29434722

fbshipit-source-id: 74dbec506fb0985379480815380118cd41058aec
2021-06-28 12:50:26 -07:00
Meyer Jacobs
f4e636902c scmstore: delete legacy scmstore
Summary: `scmstore` is dead, long live `scmstore`.

Reviewed By: kulshrax

Differential Revision: D29405613

fbshipit-source-id: 3252a545f5b944d14c15b2a777b84a99a2d4c293
2021-06-25 21:05:24 -07:00
Andrey Chursin
f8618d807e pyerror: fix NeedSlowPath conversion
Reviewed By: quark-zju

Differential Revision: D29402119

fbshipit-source-id: 52d6ebc4dd3a6b302f5678aad4d70c66244e3714
2021-06-25 18:51:00 -07:00
Jun Wu
0183787d11 io: add API to test if the pager is active
Summary: This will be used by the next change.

Reviewed By: andll

Differential Revision: D29400533

fbshipit-source-id: e6b90bedd8d8a6cf9452dfb5c5f14f9980e12f62
2021-06-25 15:18:56 -07:00
Jun Wu
2476b4a3b3 dag: add some debug tracing around remote vertex lookup
Summary: This was used to narrow down issues.

Reviewed By: andll

Differential Revision: D29404054

fbshipit-source-id: 3bfdac332d63bdb13f40d5cf23dacec242b46d52
2021-06-25 14:35:13 -07:00
Jun Wu
63b7d3a25d pydag: fix wrong filternodes(local=True)
Summary:
The logic was wrong. If local is True, vertexes is a filtered list, while nodes
isn't. They cannot be mix-used.

Reviewed By: andll

Differential Revision: D29403466

fbshipit-source-id: 06f0853282b0f284d5b2970bfa37589ef59f6169
2021-06-25 14:35:13 -07:00
Meyer Jacobs
084004fd2b checkout: update native checkout to new scmstore
Summary:
Straightforward conversion of native checkout implementation from old scmstore API to new (non-async, batched) scmstore API.

We'll meet again someday soon, async.

Reviewed By: andll

Differential Revision: D29321512

fbshipit-source-id: 1e3e0d92c95730a5c2df610061f6faf5b1eb9068
2021-06-25 10:57:56 -07:00
Jun Wu
cf020c59e7 pyerror: expose NeedSlowPathError
Summary:
Make it possible for Python to detect the error and fallback to slow path
accordingly.

Reviewed By: andll

Differential Revision: D29369067

fbshipit-source-id: 1de6162532b145469c09070bdf843ec96d38e431
2021-06-24 17:54:46 -07:00
Arun Kulshreshtha
7ffa37c5e9 pyedenapi: use block_unless_interrupted instead of block_on_future
Summary: Previously, it was not possible to interrupt `hg` during EdenAPI fetch operations. This made it impossible to interrupt long-running fetches, which is very frustating to users. This can be simply fixed by using `block_unless_interrupted` in place of `block_on`.

Reviewed By: quark-zju

Differential Revision: D29344670

fbshipit-source-id: 3b0d36dda28f5f7cc812a07981f295f8d0fbdd8a
2021-06-23 19:01:22 -07:00
Meyer Jacobs
640767d414 scmstore: track contentstore fallbacks
Summary:
Introduce basic contentstore fallback tracking to help monitor the scmstore shim rollout.

This will be expanded to a general fetch metrics system for scmstore in a future change.

Reviewed By: kulshrax

Differential Revision: D29305839

fbshipit-source-id: c6cc3ea15a3bb7b90f4ec298febc911ec4e2af91
2021-06-23 15:26:26 -07:00
Andrey Chursin
c37c61cc0d pydag: add importpulldata binding
Reviewed By: quark-zju

Differential Revision: D29317065

fbshipit-source-id: 19597b72cd3c210f43425df30fbe7e2312e33370
2021-06-23 14:51:39 -07:00
Meyer Jacobs
c891c84967 scmstore: introduce LegacyStore trait for scmstore shim
Summary:
Introduce `LegacyStore` trait, which contains ContentStore methods not covered by other datastore traits.

Implement this trait for both contentstore and scmstore, and modify rust code which consumes `contentstore` directly to use `PyObject` and `LegacyStore` to abstract over both contentstore and scmstore instead.

Reviewed By: DurhamG

Differential Revision: D29043162

fbshipit-source-id: 26e10b23efc423265d47a8a13b25f223dbaef25c
2021-06-18 17:39:53 -07:00
Andrey Chursin
c8d63eff2f async: replace block_on_future with block_on
Summary:
For a while we had two methods in async runtime: block_on_future and block_on_exclusive, due to historic reasons

Recently those methods were calling same code, and now it is time to replace both of them and rename to block_on

Reviewed By: quark-zju

Differential Revision: D29121107

fbshipit-source-id: 5faa76ae181e491b55d799c23c9de1b4e80298f3
2021-06-15 14:08:13 -07:00
Liubov Dmitrieva
99a2b85f1a upload file content
Summary:
implement uploading file content via Eden API

* in this diff I aim to upload file content for the given set of filenodes
* also, the code would check with Mononoke using the lookup request what is already there and skip those
* also, this diff introduces calculation of blake2 hash (called ContentId) for file contents (we would probably need to store/cache those and the mapping from hg filenode id to the canonical Mononoke content_id)
* for every uploaded content EdenApi returns a token that we would also need to store later

Reviewed By: markbt

Differential Revision: D29063229

fbshipit-source-id: 739a44bc3ff904cb04a39514ba5efd01c80ba6d0
2021-06-15 08:09:00 -07:00
Andrey Chursin
41c476a200 pyedenapi: add pullfastforwardmaster binding
Reviewed By: quark-zju

Differential Revision: D29118724

fbshipit-source-id: f6083244dffe2cab050330e1213c98e144d278a7
2021-06-14 21:11:15 -07:00
Jun Wu
f555f9c55d pydag: add a way to test commit existence without asking remote server
Summary: This will be used by upcoming changes.

Reviewed By: andll

Differential Revision: D29114048

fbshipit-source-id: ce963a42ebc5722ca9c61ab0a4e7a7377bbf7abb
2021-06-14 16:00:58 -07:00
Meyer Jacobs
ee1b174558 scmstore: update scmstore ExtractInnerRef types
Summary:
Modify the `ExtractInnerRef` implementations for `filescmstore` and `treescmstore` to return the new scmstore objects rather than the deprecated ones.

Modify `pycheckout` to use a new methods, `get_oldscmstore`, to access the deprecated scmstore instead (native checkout will be updated to use the new scmstore later on).

Reviewed By: DurhamG

Differential Revision: D29056498

fbshipit-source-id: 09b4655941bca048b01e6d365fcca1ccfb1cd700
2021-06-11 18:53:11 -07:00
Meyer Jacobs
5dfcaeefbd scmstore: add contentstore Python methods to filescmstore and treescmstore
Summary: Implement `ContentStore`'s Python methods on `filescmstore` and `treescmstore`.

Reviewed By: DurhamG

Differential Revision: D29042603

fbshipit-source-id: e077d7a2efc7780a384132703a2a1dc983612194
2021-06-11 18:53:10 -07:00
Meyer Jacobs
a292d63d7f scmstore: update debugscmstore to use new scmstore
Summary: Straightforward update of `debugscmstore` from old scmstore to new scmstore. I'll want to improve this command a bit more in the future, but this at least enables you to easily test arbitrary fetches.

Reviewed By: DurhamG

Differential Revision: D29047527

fbshipit-source-id: 4e10cb88cba4b572d3e413640ca3d800940d675d
2021-06-11 12:40:08 -07:00
Alex Hornby
4457092322 rust: revert zstd crates
Summary: revert the zstd crates back to previous version

Reviewed By: johansglock

Differential Revision: D29038514

fbshipit-source-id: 3cbc31203052034bca428441d5514557311b86ae
2021-06-11 04:39:54 -07:00
Meyer Jacobs
4d1dac0001 scmstore: add config to enable aux data persistence
Summary: Introduce a config for enabling separate indexedlogs for storing "aux data" in scmstore. The storage format is not yet finalized, and isn't used in production yet, so we gate the constructing it on a cofig.

Reviewed By: DurhamG

Differential Revision: D28826209

fbshipit-source-id: 1ed8c20329f21b3ced598eea16d9fac0f40112e6
2021-06-10 18:24:59 -07:00
Alex Hornby
f89dbebae8 rust: update zstd bindings to 1.5.0
Summary: Update to latest version.  This includes a patch to async-compression crate from [my PR updating it](https://github.com/Nemo157/async-compression/pull/125), I will remove once the crate is released.

Reviewed By: mitrandir77

Differential Revision: D28897019

fbshipit-source-id: 07c72f2880e7f8b85097837d084178c6625e77be
2021-06-08 07:57:29 -07:00
Jan Mazur
3054c4eb63 send additional data identifying client
Summary: This will be used for rate limiting decisions. Also, could be logged to scuba tables to get more info about clients.

Reviewed By: quark-zju

Differential Revision: D28750197

fbshipit-source-id: 83f54e38f998c9dd824ef2d3834c777a44d0ffed
2021-06-07 06:38:37 -07:00
Liubov Dmitrieva
7fc42817cb edenapi: create a call to the lookup API for different types
Summary:
create end to end intergation for the lookup API on the client

Start prototyping of `hg cloud upload` command.

Currently, it just performs lookup for existing heads.

This way we can end to end test the new APIs.

Reviewed By: markbt

Differential Revision: D28848205

fbshipit-source-id: 730c1ed4a21c1559d5d9b54d533b0cf551c41b9c
2021-06-04 10:11:25 -07:00
Meyer Jacobs
09b49e5e06 scmstore: add python method for fetching contentshas for a list of keys
Summary:
Add the `fetch_contentsha256` python method to `filescmstore`, which accepts a list of keys and returns a list of (key, sha256).

This is intended to be used by the modified `status` command implementation, which will prefer comparing content hashes to directly comparing file content.

Reviewed By: DurhamG

Differential Revision: D28696618

fbshipit-source-id: a0304319b0a19d4f09d07bec02dc41964aec7255
2021-05-27 14:42:23 -07:00
Jun Wu
f8f149c2ac pydag: make async function interruptible
Summary:
Use the interruptible block_on API so the Python methods can be interrupted by Ctrl+C.
This is especially useful if some operation triggers lots of expensive network fetches.

Reviewed By: DurhamG

Differential Revision: D28723008

fbshipit-source-id: b6c692de6290a49852eabcd960ebd9b2fb68685a
2021-05-26 19:00:01 -07:00
Jun Wu
687761400c pydag: make full->lazy migration support migrating non-master heads
Summary:
This will be used by the next change to migrate from a non-lazy changelog to a
lazy changelog.

Reviewed By: DurhamG

Differential Revision: D28700898

fbshipit-source-id: ff12754f224586b9d0d62f73b41bbb07fc7a6eea
2021-05-26 15:27:16 -07:00
Durham Goode
2e6735be81 patch: fix infinite loop for incorrect patches
Summary:
If a patch declared the length of it's last hunk as N lines, but it
only contained N-1 lines, the Rust code would enter into an infinite loop. This
could happen if a text editor remove the trailing spaces from a patch file.

Let's fix it and add a test

Reviewed By: kulshrax

Differential Revision: D28683977

fbshipit-source-id: 0a999ae108676531a2cf18e77a3b426ba4647164
2021-05-26 11:18:19 -07:00
Jun Wu
318f2ae812 metalog: expose compact and path API to Python
Summary:
The "compact" API rebuilds the metalog by removing older history. It could be
useful to reduce the size overhead of the metalog.

This is also useful if we're doing other "rebuild" work, such as rebuilding the
changelog.

Reviewed By: DurhamG

Differential Revision: D28550903

fbshipit-source-id: 56f875bd955247181236a976dcce6163d126a4b6
2021-05-24 11:44:55 -07:00
Johan Schuijt-Li
daf7eb2138 add decompression support for mononoke
Summary:
Support decompression for mononoke connections. When we request it, Mononoke
can support compression our stream, saving bandwith on low throughput
connections.

Reviewed By: StanislavGlebik

Differential Revision: D28535058

fbshipit-source-id: 7594f72978093a474efd168bb87b41c415310d6c
2021-05-20 10:22:56 -07:00
Thomas Orozco
846a983d67 thrift/lib/rust: update to Bytes 1.x
Summary:
Like it says in the title. The API between Bytes 1.x has changed a little bit,
but the concepts are basically the same, so we just need to change the
callsites that were calling `bytes()` and have them ask for `chunk()` instead.

This diff attempts to be as small as it can (and it's already quite big). I
didn't attempt to update *everything*: I only updated whatever was needed to
keep `common/rust/tools/scripts/check_all.sh` passing.

However, there are a few changes that fall out of this. I'll outline them here:

## `BufExt`

One little caveat is the `copy_to_bytes` we had on `BufExt`. This was
introduced into Bytes 1.x (under that name), but we can't use it here directly.

The reason we can't is because the instance we have is a `Cursor<Bytes>`, which
receives an implementation of `copy_from_bytes` via:

```
impl<T: AsRef<[u8]>> Buf for std::io::Cursor<T>
```

This means that implementation isn't capable of using the optimized
`Bytes::copy_from_bytes` which doesn't do a copy at all. So, instead, we need
to use a dedicated method on `Cursor<Bytes>`: `copy_or_reuse_bytes`.

## Calls to `Buf::to_bytes()`

This method is gone in Bytes 1.x, and replaced by the idiom
`x.copy_to_bytes(x.remaining())`, so I updated callsites of `to_bytes()`
accordingly.

## `fbthrift_ext`

This set of crates provides transports for Thrift calls that rely on Tokio 0.2
for I/O. Unfortunately, Tokio 0.2 uses Bytes 0.5, so that doesn't work well.

For now, I included a copy here (there was only one required, when reading from
the socket). This can be removed if we update the whole `fbthrift_ext` stack to
Bytes 1.x. fanzeyi had been wanting to update this to Tokio 1.x, but was blocked on `thrift/lib/rust` using Bytes 0.5, and confirmed that the overhead of a copy here is fine (besides, this code can now be updated to Tokio 1.x to remove the copy).

## Crates using both Bytes 0.5 & Bytes 1.x

This was mostly the case in Mononoke. That's no coincidence: this is why I'm
working on this. There, I had to make changes that consist of removing Bytes
0.5 to Bytes 1.x copies.

## Misuse of `Buf::bytes()`

Some places use `bytes()` when they probably mean to use `copy_to_bytes()`. For
now, I updated those to use `chunk()`, which keeps the behavior the same but
keeps the code buggy. I filed T91156115 to track fixing those (in all
likelihood I will file tasks for the relevant teams).

Reviewed By: dtolnay

Differential Revision: D28537964

fbshipit-source-id: ca42a614036bc3cb08b21a572166c4add72520ad
2021-05-20 09:44:41 -07:00
Meyer Jacobs
156b81f94a scmstore: TreeStore & FileStore pyrevisionstore constructor integration
Summary: Modifies `treescmstore` and `filescmstore` to also construct `TreeStore` and `FileStore` respectively. Currently these newly constructed stores are not used anywhere, no application code behavior should change as a result of this.

Reviewed By: DurhamG

Differential Revision: D28237680

fbshipit-source-id: 2bf3fd4b96be8c26e5c1e55cfd2e865f98e6ba91
2021-05-19 16:48:20 -07:00
Jun Wu
e0f02950ea pyedenapi: add trees API unrelated to store
Summary: Add a way to fetch tree content without going through store.

Reviewed By: liubov-dmitrieva

Differential Revision: D28200387

fbshipit-source-id: 8f5b2214aafba39c7674f0f6b27af0c985f0ea72
2021-05-05 09:48:29 -07:00
Jun Wu
e687a92d10 pyedenapi: rename trees to storetrees
Summary:
The `trees` API is coupled with a store. We're going to add another API that is
not coupled with a store so let's rename `trees` to `storetrees`.

Reviewed By: liubov-dmitrieva

Differential Revision: D28200389

fbshipit-source-id: 826116f0b461873b2f5df07e7fd35e6d1018f929
2021-05-05 09:48:29 -07:00
Durham Goode
27d58bbd42 configs: delete applydynamicconfig
Summary: This is no longer used.

Reviewed By: quark-zju

Differential Revision: D26676518

fbshipit-source-id: 1cc9c32e2a95d6db78160f33ab5423338ea82e04
2021-05-04 22:18:55 -07:00