Commit Graph

332 Commits

Author SHA1 Message Date
Stanislau Hlebik
5b968c201c mononoke: add get_linknode method to BlobRepo
Summary: It will be used by many things, in particular by gettreepack method

Reviewed By: jsgf

Differential Revision: D6845036

fbshipit-source-id: 3174dfafeeab830ededb70ddff3dd62f6a608d54
2018-02-02 07:01:57 -08:00
Stanislau Hlebik
8c64a71028 mononoke: move changed_entry_stream to manifest_utils
Summary:
It will be used in other places, such as repoconfig.
Unfortunately I had to split tests and implementation. The reason is that tests
depend on blobrepo. Blobrepo crate depends on mercurial_types and that causes
circular dependency. It shouldn't be the case, because
mercurial_types_unittests should be a separate crate, so there may be a bug in
the build system. For now I've split the tests and implementation.

Reviewed By: jsgf

Differential Revision: D6857098

fbshipit-source-id: 1c0af234564dd5628ba6d63d28cf54d7a2dc9217
2018-02-02 07:01:56 -08:00
Arun Kulshreshtha
3e619d7095 Enable mysql and sqlite features for diesel crate
Summary:
Per the title, enable the mysql and sqlite backends for diesel, so
that we can experiment with using diesel with those two DBMSs.

Reviewed By: jsgf

Differential Revision: D6854679

fbshipit-source-id: 66581db1bcafbcc422ababb969500e5d4dd5fafc
2018-02-01 15:38:04 -08:00
Jeremy Fitzhardinge
9df09a500c mononoke/hgproto: remove dep on tokio-proto
Summary: It wasn't needed

Reviewed By: Imxset21

Differential Revision: D6862155

fbshipit-source-id: 21a0d1202e32caba96fb7d6e0923bf2f99f028ea
2018-01-31 13:36:45 -08:00
Jeremy Fitzhardinge
284eb54252 mononoke: documentation pass over mercurial-types/manifest
Summary:
Add some doc comments. Also added tasks for things that at least need
to be looked at.

Reviewed By: StanislavGlebik

Differential Revision: D6836570

fbshipit-source-id: 107f1f4799a369f11fdec7dbe051764a287e3a24
2018-01-31 13:36:45 -08:00
Katherine McKinley
5c1e5825b0 Convert NodeHash to ChangesetId in BlobChangeset
Summary: Change BlobChangeset and callers to use ChangesetId instead of NodeId

Reviewed By: lukaspiatkowski

Differential Revision: D6835450

fbshipit-source-id: 7b20359837632aef4803e40965380c38f54c9d0a
2018-01-31 13:36:45 -08:00
Stanislau Hlebik
28939bbf11 mononoke: add changed_entry_stream
Summary:
This is a stream of diffs between two manfiests. It will be used in
`gettreepack` wireproto method of treemanifest.

This implementation is slow and simple, because it fetches from blobstore sequentially. We'll make it faster later if needed

Reviewed By: lukaspiatkowski

Differential Revision: D6808892

fbshipit-source-id: 3edcd02a287276b6015ac73fbe977a5b6d8573b5
2018-01-30 01:33:06 -08:00
Stanislau Hlebik
5170568488 mononoke: add many_files_dirs test fixture
Summary:
Add a fixture where there are many files and directories.
History is linear for now, but later we may add merge commtis.
It will be used to test gettreepack method.

Reviewed By: lukaspiatkowski

Differential Revision: D6818544

fbshipit-source-id: 798a1bea66eb49491f98fe5e997b172f3c927c53
2018-01-30 01:33:06 -08:00
Jeremy Fitzhardinge
853bade3ac Update all third-party crates
Summary:
Update tp2 links for rust-crates-io and add corresponding build fixes due to
API changes.

Reviewed By: kulshrax

Differential Revision: D6824642

fbshipit-source-id: 5f30fa75815a6bb2de593878c40c0fa44219c3f3
2018-01-26 16:06:53 -08:00
Stanislau Hlebik
5d1bcd7a67 mononoke: fix test
Summary: Mercurial was updated, it doesn't print 'new head created' anymore

Reviewed By: farnz

Differential Revision: D6819007

fbshipit-source-id: 9ead8d0d9c165f3c8d9a6f519642012edfbc6013
2018-01-26 08:20:45 -08:00
Julian Priestley
67e908efe0 Use ChangesetId rather than NodeHash in bookmarks
Summary: Update the bookmarks module to use ChangesetId to represent bookmarks, rather than NodeHash.

Reviewed By: lukaspiatkowski

Differential Revision: D6774650

fbshipit-source-id: 1742e4e78798ad68a7f17ebd345eef14a7de2cec
2018-01-22 10:23:36 -08:00
Simon Farnsworth
6703981f74 Remove Blobstore parameter from BlobEntry et al
Summary:
This will (in practice) always be `Arc<Blobstore>`, so push down and
make it the concrete type.

Reviewed By: jsgf

Differential Revision: D6761690

fbshipit-source-id: c279751d98a8882c209b79faa7cbfd3e635beda5
2018-01-22 05:22:14 -08:00
Stanislau Hlebik
0ba15b96a5 mononoke: fix lookup command param parsing
Summary:
Previously parsing code assumed that lookup param is an ident string. This is
incorrect, because ident string accepts only strings that consist only of
digits and small letters and start with a letter. Since a hash can be a lookup
param, this param may start with non-letter. More importantly, any bookmark can
be a lookup parameter. That means that this param can have spaces and
punctuation marks.

Let's use simpler parsing that just parses the whole string.

Reviewed By: jsgf

Differential Revision: D6758916

fbshipit-source-id: de2dd144cebfe88c751e8110ef6e3a71d3769800
2018-01-21 07:37:30 -08:00
Stanislau Hlebik
09542720e4 mononoke: add TestBlobManifold config
Summary:
Config to connect to manifold. It's a test version, because it uses in-memory
bookmarks and heads.

Because Manifold BlobRepo require Remote to the tokio_core, I had to do a bit
of refactoring and delay BlobRepo creation. Now it's created after the
corresponding thread is created.

Reviewed By: jsgf

Differential Revision: D6748462

fbshipit-source-id: f14a3c98a6a00f44b5557255bc514df34325420f
2018-01-21 07:37:30 -08:00
Stanislau Hlebik
91bbf73fcb mononoke: rustfmt repoconfig.rs
Reviewed By: jsgf

Differential Revision: D6748460

fbshipit-source-id: 51eb68e41a209c310cb30f884dd2173a2cfd9a1b
2018-01-21 07:37:30 -08:00
Stanislau Hlebik
906035f526 mononoke: basic getbundle changegroup implementation
Summary:
Super-basic implementation of generating changegroup part in getbundle. All it does is sending changelog
entries - so no manifest and no filelog entries. While it's very simple, it may
actually be enough for a real production use-case. With treemanifest and
remotefilelog we don't need to pull anything except for changelog entries,
everything else will be downloaded on demand.

Reviewed By: jsgf

Differential Revision: D6748070

fbshipit-source-id: 1dcd802a4b3b111f935e713e7696d58f05861b77
2018-01-21 07:37:30 -08:00
Stanislau Hlebik
d8b09b8902 mononoke: fix changeset entry generation
Summary:
Previously cs entry generation would always add " " after timezone even if
extras are empty. That's incorrect and this diff fixes it.

Reviewed By: jsgf

Differential Revision: D6747886

fbshipit-source-id: 03b33a7b3be8041f84cdbc5e0324fc78339b6802
2018-01-21 07:37:30 -08:00
Stanislau Hlebik
523815b3d2 mononoke: factor out serialize_cs() method
Summary: This method will be used during pull to generate changegroup parts

Reviewed By: jsgf

Differential Revision: D6737183

fbshipit-source-id: 8b0df5199abd8fceb990323346684075b93b880d
2018-01-21 07:37:29 -08:00
Siddharth Agarwal
9697c1133e hgproto: accept empty hashlists and pairlists
Summary:
`complete!` had to be wrapped around both the separator and the input parser.
`separated_list_complete!` does that automatically, which is nice.

Reviewed By: jsgf

Differential Revision: D6758479

fbshipit-source-id: a2fe94a422a1b4a1c09bbfa915cde19d968d3273
2018-01-19 13:51:03 -08:00
Siddharth Agarwal
87bb4c1ea8 mercurial-bundles: wirepack packer
Summary:
This doesn't have any integration tests yet, but it should work and hopefully
unblock StanislavGlebik.

Reviewed By: jsgf

Differential Revision: D6753800

fbshipit-source-id: be05e45d33e433b5cd002b8e7ae8feb255369900
2018-01-19 13:51:03 -08:00
Stanislau Hlebik
3e7319dcfc asyncmemo: record all the tasks that polled the future
Summary:
Previously if we had two different tasks (or the same tasks but with different
Notify, as in
[FuturesUnordered](http://alexcrichton.com/futures-rs/futures/stream/futures_unordered/struct.FuturesUnordered.html)),
interchangebly polling the future, only one latest future completes, and all
other futures receive no `notify()` call and may never finish.
This diff fixes it by storing a list of tasks that ever polled a future.

Note that if future was polled twice by the same task, the task will be
recorded twice. This is not great, but unfortunately one can't compare Tokio's
tasks.

Reviewed By: lukaspiatkowski

Differential Revision: D6611511

fbshipit-source-id: 2742cb85b13a684699a13a874e36e17b29fb4480
2018-01-19 02:18:10 -08:00
Stanislau Hlebik
9ba06ebc3c asyncmemo: remove entry with the same key before inserting new one
Summary:
There was a bug when if the entry with the same key is present in the hash and
the hash is full, then some entry will be evicted even though it's not
necessary.
It adds one hash map lookup, but it shouldn't be a big problem

Reviewed By: jsgf

Differential Revision: D6702001

fbshipit-source-id: 1c8cadc5e4bad6f6d95279b21edf00ed99f62c49
2018-01-19 01:10:27 -08:00
Xiaotian Wu
2c4d93ceb8 modify entryid related code
Summary: modify entryid code

Reviewed By: lukaspiatkowski

Differential Revision: D6722202

fbshipit-source-id: 1df45071709f4a425374a87a29553830071b5d2d
2018-01-16 07:57:25 -08:00
Xiaotian Wu
92c0528b1f modify manifestid related code
Summary: nodehash -> manifestid

Reviewed By: lukaspiatkowski

Differential Revision: D6719378

fbshipit-source-id: 1ec59b33270e389da8e74b3864c37a86c9d89f81
2018-01-16 07:57:25 -08:00
Xiaotian Wu
ed94c6702c modify changesetid related code
Summary: modify the parameter type

Reviewed By: lukaspiatkowski

Differential Revision: D6695443

fbshipit-source-id: fafcdc83773cb86c08cdcf3a8d80c1c9a498eca5
2018-01-16 07:57:25 -08:00
Xiaotian Wu
7a3ef80526 add changesetid/manifestid/entryid structure
Summary: add wrapper for nodehash

Reviewed By: lukaspiatkowski

Differential Revision: D6694937

fbshipit-source-id: c1c79fd8fb37d40211b84341105af1d6fa155708
2018-01-16 07:57:24 -08:00
Lukas Piatkowski
70244ff1d6 hgproto: nearly end-to-end support for handling protocol in streaming fashion
Reviewed By: jsgf

Differential Revision: D6494647

fbshipit-source-id: e685b33a35f49365d2cfa89491b1566cfcc75118
2018-01-15 10:36:32 -08:00
Lukas Piatkowski
0d8cc77882 future-ext: introduce ByteStream for efficient processing stream of bytes
Reviewed By: jsgf

Differential Revision: D6494542

fbshipit-source-id: d069137326697105a402261e4fbe69ab95ade67e
2018-01-15 10:36:32 -08:00
Lukas Piatkowski
5185252a8b mercurial_bundles: make Bundle2Stream sendable across threads
Reviewed By: farnz

Differential Revision: D6612214

fbshipit-source-id: 4dc672f2f1f31c516e4e2c7c58de5cbade61db61
2018-01-15 10:36:32 -08:00
Lukas Piatkowski
8244a3c4b5 mercurial_bundle: return remaining data as last item of stream
Reviewed By: jsgf

Differential Revision: D6601718

fbshipit-source-id: 34019701bda3e187ce77a85ef04fef5d726d2286
2018-01-15 10:36:31 -08:00
Lukas Piatkowski
2e25098dc0 async-compression: add support for gzip format
Reviewed By: jsgf

Differential Revision: D6567611

fbshipit-source-id: 5aad3e11659c0f2cd135496f627180a1e7cce41c
2018-01-15 10:36:31 -08:00
Lukas Piatkowski
533cad062f futures-ext: remove FramedStream and replace it's usages with tokio_io::codec::Framed
Summary: The Framed and FramedParts duet fits following diffs a bit better than FramedStream and ReadLeadingBuffer.

Reviewed By: jsgf

Differential Revision: D6567554

fbshipit-source-id: 88d117ad9e8227f9de278037b333da7ffc4fdf1f
2018-01-15 10:36:31 -08:00
Lukas Piatkowski
f59d6a1c8b async-compression: make sure decompression is framed and won't overread it's input
Summary:
- Added test for checking if decompressing isn't overreading it's input
  - As a result removed ZSTD decompression which is overreading input
- Changes in decompression code propagated usage of BufRead in bundle2 parsing code
  - As a result a bug in OuterDecoder was found where the buf was not consumed if the header value is "0"

Reviewed By: jsgf

Differential Revision: D6557440

fbshipit-source-id: 89a9f4c8790017c5b86d28d467e45f687d7323f6
2018-01-15 10:36:31 -08:00
Lukas Piatkowski
35e3c19f1c async-compression: remove the no-compression compressor/decompressor
Summary:
The no-compression decompressor cann't provide framing as other decompressors, so a safe approach would be not to have it at all.
I replaced occurances of no-compression with `Either` reader that seem to be a pattern present in the community (f.e. `futures::future::Either` or `itertools::Either`)

Reviewed By: jsgf

Differential Revision: D6555922

fbshipit-source-id: 998dafab8d9b2f00d058ce2f9e0aced76cf15b4e
2018-01-15 10:36:31 -08:00
Simon Farnsworth
ebafde00b0 Remove Repo trait completely
Summary:
We're never going to serve RevlogRepo in production, and we're down to
a single BlobRepo type that will have different backing stores. Remove the
unused trait, and use BlobRepo everywhere bar blobimport and repo_config
(because we previously hardcoded revlog here - we want to change to a BlobRepo
once blobimport is full-fidelity).

Reviewed By: jsgf

Differential Revision: D6596164

fbshipit-source-id: ba6e76e78c495720792cbe77ae6037f7802ec126
2018-01-15 06:37:27 -08:00
Siddharth Agarwal
df1590c586 updates for rustfmt 0.3.4
Summary:
One config option is now obsolete, and the other one got renamed.

(Note: this ignores all push blocking failures!)

Reviewed By: farnz

Differential Revision: D6668021

fbshipit-source-id: aff949662a9584b7aead3f571512787aa1e9a260
2018-01-05 12:07:01 -08:00
Stanislau Hlebik
1417398de8 mononoke: move ssl config options to the separate toml config section
Summary: It removes a bit of copy-pastes code

Reviewed By: sid0

Differential Revision: D6627250

fbshipit-source-id: b110dcad998a240b6da60bc3347c7c5c0370aae0
2018-01-04 07:36:34 -08:00
Stanislau Hlebik
15d23af540 mononoke: get rid of filesblob state
Summary:
It won't be used in prod anyway, and for local use rocksdb blob state is still
preferable

Reviewed By: sid0

Differential Revision: D6627197

fbshipit-source-id: d9ca55b0221c050e8e8e35914aff22906198874a
2018-01-04 07:36:34 -08:00
Siddharth Agarwal
886e67bad2 integration: allow running a subset of tests
Summary: integration_runner.py now takes test arguments.

Reviewed By: jsgf

Differential Revision: D6607064

fbshipit-source-id: ed8271b67e76bebe92bca3931fc3620aaf577b51
2018-01-01 17:52:36 -08:00
Siddharth Agarwal
64e5182680 fix test-init.t
Summary:
The test wasn't waiting for the Mononoke server to be available. Also
improve the error message slightly.

Reviewed By: jsgf

Differential Revision: D6606102

fbshipit-source-id: d0fde39aef8b3423fd1a8996a01f12e8a9661597
2018-01-01 17:52:36 -08:00
Siddharth Agarwal
c6d65b47b0 wirepack: support for encoding data entries
Summary:
This is very similar to the support for encoding history entries in the
previous patch. The NULL_HASH wart makes it a little annoying to deal with.

We need to be able to compute how many bytes a delta has efficiently -- add a
function and tests for that as well.

Reviewed By: jsgf

Differential Revision: D6589117

fbshipit-source-id: e3a05672e1e8f455a2e95b30418468d1e3254407
2018-01-01 17:52:36 -08:00
Siddharth Agarwal
f6610ae558 thrift: extract SizeCounter to a separate crate
Summary:
This counter is generally quite useful, so extract it into a location
where Mononoke can also use it.

Also add ShipIt and corresponding license linter rules for this.

Reviewed By: jsgf

Differential Revision: D6600409

fbshipit-source-id: ce63d718ca259ac30d2ed77e72004fb83158f818
2018-01-01 17:52:35 -08:00
Stanislau Hlebik
45f1fbdd4e asyncmemo: use spawn() in tests
Summary:
In the next diff we'll `task::current()` inside MemoFuture. It fails if no
task exists. Let's use spawn to create a Task for each future.

Reviewed By: jsgf

Differential Revision: D6611510

fbshipit-source-id: 95a825dff9714579e9b16e74f355c54d8fa83a24
2017-12-22 03:41:22 -08:00
Stanislau Hlebik
79c6006853 rust: asyncmemo rustfmt
Summary: rustfmt

Reviewed By: jsgf

Differential Revision: D6611512

fbshipit-source-id: 84c8306015e961ea283341fc1a52c153f3db2a49
2017-12-22 03:41:22 -08:00
Stanislau Hlebik
e734b3f9be asyncmemo: fix hash size calculation
Summary: Previously inserting the same key twice will add size of this key twice.  This diff fixes it.

Reviewed By: jsgf

Differential Revision: D6602501

fbshipit-source-id: eb8f785296945bca1df4b6cd33bd3050a48e2174
2017-12-22 03:41:22 -08:00
Siddharth Agarwal
0616b6ec4c wirepack: support for encoding history entries
Summary:
This is the opposite of decode. Encode -> decode trips are also easily
testable, which is nice.

Reviewed By: jsgf

Differential Revision: D6586165

fbshipit-source-id: 9300844da5c3210cfbe4b6a3c98c6429d33ccbcb
2017-12-18 22:08:38 -08:00
Siddharth Agarwal
17a6667058 wirepack: represent entry counts as u32, not usize
Summary:
This is what we get or send over the wire, so while encoding we don't have to
check whether the value is in bounds.

Reviewed By: jsgf

Differential Revision: D6596025

fbshipit-source-id: 57fcefbe3545a1af4c4c4ea24350e636860d2392
2017-12-18 22:08:38 -08:00
Siddharth Agarwal
006b974208 wirepack: initial quickcheck support
Summary:
This just adds a basic verification test for now. Roundtrip tests are coming up
in future diffs.

Reviewed By: jsgf

Differential Revision: D6585421

fbshipit-source-id: 1f38366f658324447dbe5634afb04080aad91cd3
2017-12-18 22:08:37 -08:00
Siddharth Agarwal
af8e56d459 wirepack: support for verifying data entries
Summary:
The only verification that needs to be done is for if the delta base
is null.

Also move a rustfmt_skip attribute to the smallest piece of code that it needs to
apply to.

Reviewed By: jsgf

Differential Revision: D6589118

fbshipit-source-id: 287c94871ed30d196c9eaa673cfd7c7f0dd6ed93
2017-12-18 22:08:37 -08:00
Siddharth Agarwal
06f88ad102 wirepack: support for verifying history entries
Summary:
The encoding code is going to use this to ensure that it isn't getting invalid
data.

Reviewed By: jsgf

Differential Revision: D6585201

fbshipit-source-id: f7ca749d9d0a8862621816e362add7546ca413c5
2017-12-18 22:08:37 -08:00