Commit Graph

1220 Commits

Author SHA1 Message Date
Stefan Filip
8266b7015f dag-types: add Location
Summary: Used when the IdMap is lazy to fetch missing locations.

Reviewed By: quark-zju

Differential Revision: D26131617

fbshipit-source-id: cde0232b16afb961d9c9a18899ca78bd644f1b6b
2021-02-09 11:31:30 -08:00
Stefan Filip
3676aa38ec dag-types: re-export submodules types
Summary:
I think that it makes sense to standardize on importing:
`dag_types::Id` rather than `dag::Id` now that this is a crate of its own.

I am not sure about re-exporting `minibytes::Bytes` but it makes sense to me.

Reviewed By: quark-zju

Differential Revision: D26131616

fbshipit-source-id: fefd0334cf188f247b1541be16421967e8340546
2021-02-09 11:31:29 -08:00
Stefan Filip
0a910c4182 dag: rename dag-wire-types to dag-types
Summary:
Wire types has it's own meaning in Edenapi. I don't see it necessary to
add the wire qualifier to this crate and overload the term.

Reviewed By: quark-zju

Differential Revision: D26129827

fbshipit-source-id: eea66eef2db609611d8ffa215ba63ae4f0b669c8
2021-02-09 11:31:29 -08:00
generatedunixname89002005325677
e1578c6e23 Daily arc lint --take RUSTFMT
Reviewed By: zertosh

Differential Revision: D26334348

fbshipit-source-id: 589f4eb91fc42279c8851a3964f95523418989cd
2021-02-09 04:05:27 -08:00
Ivan Murashko
bf540eef33 HTE lint-ignore message cleanup at fbcode (#8799)
Summary:
Pull Request resolved: https://github.com/facebook/hhvm/pull/8799

Pull Request resolved: https://github.com/facebookexperimental/eden/pull/72

Pull Request resolved: https://github.com/facebook/openr/pull/82

Pull Request resolved: https://github.com/facebook/fbthrift/pull/410

The diff removes HOWTOEVEN from all lint-ignore messages at fbcode

Reviewed By: dkgi

Differential Revision: D26278830

fbshipit-source-id: d0233030a0aacc44c3dfc5694475027150f2a442
2021-02-09 03:23:33 -08:00
Meyer Jacobs
44d1239275 newstore: introduce a trait-object-based "fallback combinator"
Summary:
Introduce `FallbackStore`, a newstore combinator which implements the `ReadStore` trait and first checks a "preferred" store for the provided keys, before falling back to a "fallback" store. The combinator requires that both stores share the same `Key` type, but allows a user provided "value adapter function" to convert from the fallback store's value type to the preferred store's value type.

Currently `FallbackStore` does not support writing missing values to the preferred store - this functionality will be introduced in a future change.

Reviewed By: DurhamG

Differential Revision: D26203146

fbshipit-source-id: 0e99110f93130ff30c95cce15e3dc7873616519c
2021-02-08 10:39:32 -08:00
Meyer Jacobs
2f0d2c4105 util: introduce a select_drop stream combinator
Summary: Introduce a new stream combinator, `select_drop`, based on `futures::stream::select`, which performs the same function except dropping the contained streams when they terminate, rather than when the combined stream is exhausted. This prevents a deadlock in cases where one stream will not terminate until the other terminates.

Reviewed By: DurhamG

Differential Revision: D26139816

fbshipit-source-id: d28da32244a215741476e1c3882154ea9e3116a5
2021-02-08 10:39:32 -08:00
Meyer Jacobs
79656a50a1 newstore: add minimal indexedlog adapter for ReadStore trait
Summary: Introduces a minimal `ReadStore` implementation for `IndexedLogHgIdDataStore`.

Reviewed By: DurhamG

Differential Revision: D26113280

fbshipit-source-id: 68dd7f44b51b495033de354b10373b84dab40930
2021-02-08 10:39:31 -08:00
Meyer Jacobs
ef00b68647 newstore: minimal proof of concept trait & edenapi implementation
Summary: Introduce a minimal version of an async, typed `ReadStore` trait and corresponding `EdenApi` implementation, along with a debug command, `debugnewstore` to exercise it.

Reviewed By: DurhamG

Differential Revision: D26050641

fbshipit-source-id: 2c14c3715e7067f9ecd1e649e6ca146a1ce249bf
2021-02-08 10:39:31 -08:00
Jun Wu
e817eb52e9 minibytes: add Bytes::into_vec
Summary:
Make it possible to convert Bytes to `Vec<u8>` in a zero-copy way if possible.

This will make it possible to convert `minibytes::Bytes` to `bytes::Bytes` in a
zero-copy way if possible. Practically, it might be useful for some
revisionstore -> edenapi/types usecases.

Reviewed By: kulshrax

Differential Revision: D26237922

fbshipit-source-id: 28d620f303511099df77f79256d98abb1010f665
2021-02-05 13:57:49 -08:00
Jun Wu
16a92c5cc1 minibytes: add downcast_mut
Summary: This API will be used in the next diff.

Reviewed By: DurhamG

Differential Revision: D26237923

fbshipit-source-id: 69438072c2edef1ce28ceef3b8b723f015f54ff5
2021-02-05 13:57:48 -08:00
Jun Wu
bcc93466b0 dag: add NameSet.{skip,take}
Summary: Provide a way to slice a set.

Reviewed By: sfilipco

Differential Revision: D26203562

fbshipit-source-id: 97a4349833a7a1c9664189d4737e2ad418369f22
2021-02-05 12:00:40 -08:00
Jun Wu
e6f7511dea dag: add SliceSet
Summary:
The SliceSet provides slicing support (skip n items, and then take m items)
for a general NameSet. The complexities come from caching and fast paths.
Basically, we cache the skipped items as a way to answer "contains" quickly.
We also cache the "taken" items if it's bounded to answer "iter_rev",
"contains".

Reviewed By: sfilipco

Differential Revision: D26203559

fbshipit-source-id: 6078b6178aff878e2169e87d446f0b254432aa80
2021-02-05 12:00:40 -08:00
Jun Wu
57053124b2 dag: add NameSetQuery.contains_fast
Summary:
In the future we'd like to test "contains" but only use the "contains"
code path if it's better than O(N). Currently there is no way to know
whether "contains" is O(N) or not. Add an explicit API for that.

Reviewed By: sfilipco

Differential Revision: D26203554

fbshipit-source-id: 5d4c6014694c45b666a0ecd83fce33157cc15779
2021-02-05 12:00:39 -08:00
Jun Wu
6c8a4d7db9 dag: test hints set by NameSet::filter
Summary: Enhance the test so it checks hints set by the `filter` function.

Reviewed By: sfilipco

Differential Revision: D26203553

fbshipit-source-id: b9bf5baa3bf51434835341e95e72073bd8c4256a
2021-02-05 11:53:47 -08:00
Jun Wu
e2dfdcb094 dag: fix Hints::union
Summary:
It is incorrect with >= 2 hints.
For example,

        iter: [hints1, hints2, hints1]
    fold acc:  hints1, None,   hints1

The `None` should be permanent if there are two versions that do not have an
order.

Reviewed By: sfilipco

Differential Revision: D26203555

fbshipit-source-id: 96ff30ba45d439220519cd1505e3264118ffd9b2
2021-02-05 11:53:46 -08:00
Jun Wu
95668fd91d dag: ensure LazySet has Hints set
Summary:
Previously, `LazySet` was constructed with default `Hints`. That disables fast
paths. Revise the API so LazySet requires an explicit `Hints` to address the
issue.

Reviewed By: sfilipco

Differential Revision: D26203561

fbshipit-source-id: c92cd1f7eb7b40ffaaf53abcf05e64f3d41b906d
2021-02-05 11:53:46 -08:00
Jun Wu
3ced6804e4 dag: ensure MetaSet has Hints set
Summary:
Previously, `MetaSet` was constructed with default `Hints`. That disables fast
paths. Revise the API so MetaSet requires an explicit `Hints` to address the
issue.

Reviewed By: sfilipco

Differential Revision: D26203557

fbshipit-source-id: 9e7658af8723b06d0efdcad1ab4671c79e907326
2021-02-05 11:53:46 -08:00
Jun Wu
f8933ffbd2 dag: add IdSet.{skip,take}
Summary: Those methods will be used for fast paths slicing a NameSet.

Reviewed By: sfilipco

Differential Revision: D26203556

fbshipit-source-id: aef18f60633653e19571e3fdeeb6b258e4dd32c7
2021-02-05 11:53:45 -08:00
Jun Wu
9b02ebc711 dag: make spanset module private
Summary:
This just renames types so `IdSet` is the recommended name and `SpanSet`
remains an implementation detail.

Reviewed By: sfilipco

Differential Revision: D26203560

fbshipit-source-id: 7ca0262f3ad6d874363c73445f40f8c5bf3dc40e
2021-02-05 11:53:45 -08:00
Jun Wu
101f5066e0 dag: add NameDag.first_ancestors
Summary: This exposes the segments version of the algorithm.

Reviewed By: sfilipco

Differential Revision: D26182244

fbshipit-source-id: 716e6d5254c9962618040e7549c2804184230a97
2021-02-05 11:53:44 -08:00
Jun Wu
a362d68006 dag: add IdDag.first_ancestors
Summary: This will be used by NameDag.

Reviewed By: sfilipco

Differential Revision: D26182243

fbshipit-source-id: 9db2ecde98281dc45fcfd0d7cf30d6c7bf2be81d
2021-02-05 11:53:44 -08:00
Jun Wu
fb187ef86e dag: add DagAlgorithm.first_ancestors
Summary:
This will be useful to optimize `_firstancestors` revset, which is useful to
calculate a linear branch to draw growth graphs. Without a fast path, the pure
Python `_firstancestors` implementation would have id <-> name translation
overhead that makes Rust changelog O(20) slower than the Python revlog.

Reviewed By: sfilipco

Differential Revision: D26182240

fbshipit-source-id: d44f5ca5dc8c38df74281832931d87868791209e
2021-02-05 11:53:44 -08:00
Jun Wu
01b0122b0b revset: optimize x~n using Rust fast path
Summary:
Optimize the `x~n` revset function using Rust.

Note: This changes the behavior a bit, `x~n` no longer returns `null`.

Reviewed By: sfilipco

Differential Revision: D26142683

fbshipit-source-id: d6a45b7e67352d74986274e52002a769bbae772e
2021-02-05 11:37:51 -08:00
Jun Wu
ff8888fd79 dag: make first_ancestor_nth nullable
Summary:
When `n` is too large, return None.  This matches the "parents()" behavior -
not error out but returns empty set.

Reviewed By: sfilipco

Differential Revision: D26142684

fbshipit-source-id: e45fca69e39c2968dc7abc5a4a155e6b7c280836
2021-02-05 11:37:51 -08:00
Jun Wu
7d186b3eaa dag: add NameDag.merges
Summary: Based on IdDag.merges.

Reviewed By: sfilipco

Differential Revision: D26142171

fbshipit-source-id: cf97c6941ddc3b5c72ce71e54ddfe6d96515e330
2021-02-05 11:37:50 -08:00
Jun Wu
ef89789a1e dag: add IdDag.merges
Summary:
The "merges" algorithm on the IdDag. Basically scan through flat segments
and conditionally pick up their "low"s.

Reviewed By: sfilipco

Differential Revision: D26142172

fbshipit-source-id: 305fe619a65ed4034423f303bee8d57be0424963
2021-02-05 11:37:50 -08:00
Jun Wu
8fb1fc8fab dag: add Segment.parent_count
Summary:
The newly added API returns parent count wihtout actual parents.
Useful for the "merges" algorithm.

Reviewed By: sfilipco

Differential Revision: D26142176

fbshipit-source-id: 4f301b8de88f2af637f52bf62b24ddb12e65b6a7
2021-02-05 11:37:50 -08:00
Jun Wu
750ceb4ba7 dag: add DagAlgorithm.merges
Summary:
The function calculates all merges within a graph. It is useful to calculate
the "universally known" set, or to answer the "merge()" revset function.

This diff only adds a default impl. Upcoming diffs will add more efficient
versions on the segments graph.

Reviewed By: sfilipco

Differential Revision: D26142173

fbshipit-source-id: 02de180f6e444bcac63a1cc46dd23faeb8e08e14
2021-02-05 11:37:49 -08:00
Jun Wu
630bff794a dag: add NameSet.filter
Summary: The `filter` API filters a set by a function.

Reviewed By: sfilipco

Differential Revision: D26142177

fbshipit-source-id: f24cbeeaf1c85264706c933c98e364d7937790fe
2021-02-05 11:37:49 -08:00
Andrey Chursin
468505dc5a vfs: make audit cache concurrent
Reviewed By: quark-zju

Differential Revision: D26233458

fbshipit-source-id: e06f5642f713d0788407e3cc70655ef82261e7c2
2021-02-04 13:13:45 -08:00
Jun Wu
6956496602 lib: bytes::Bytes -> minibytes::Bytes
Summary:
The `bytes` crate still does not support zero-copy on mmaped buffer.
Switch to `minibytes::Bytes` so bytes returned from our main storage
backend indexedlog is a zero-copy slice backed by a mmap buffer.

Migrate vfs, revisionstore, pyworker to minibytes so they can preserve
zero-copy mmap buffers from indexedlog.

The edenapi/types is unchanged, since it's also used in Mononoke which uses
`bytes::Bytes` all the places. The conversion to `minibytes::Bytes` is cheap
so it's probably not a performance issue.

Reviewed By: kulshrax

Differential Revision: D26218289

fbshipit-source-id: e4f1c631143b7676c6b48d3b4f97055299bfd334
2021-02-03 20:22:32 -08:00
Jun Wu
06accd8674 minibytes: implement From<bytes::Bytes>
Summary:
Make it possible to construct minibytes::Bytes via bytes::Bytes.
This will be used later.

Reviewed By: kulshrax

Differential Revision: D26232990

fbshipit-source-id: 36af6f28fd08eb457de8b9223235ec038ac3ef14
2021-02-03 20:22:32 -08:00
Jun Wu
67b2d8e536 revisionstore: make redacted constants plain &[u8]
Summary:
Previously they were `Bytes`, which relies on `Bytes::from_static` being
a const_fn.  Going to migrate from bytes to minibytes, which has a type
parameter on `Bytes` that makes it harder to have const_fn from_static.

Switch the constants to plain `&[u8]` to avoid the const_fn issue.

Reviewed By: kulshrax

Differential Revision: D26218290

fbshipit-source-id: 728c9b3831e551f41fb42ec257ca5fe75b7e93a3
2021-02-03 20:22:31 -08:00
Jun Wu
e094e4dabd revisionstore: collect::<Bytes> -> collect::<Vec>().into()
Summary: Going to migrate from bytes to minibytes. Avoid using bytes' specific API.

Reviewed By: kulshrax

Differential Revision: D26218826

fbshipit-source-id: ba41697eab8fc5fb7bf73bc565c05a7c1b29464c
2021-02-03 20:22:31 -08:00
Jun Wu
5c6512f255 revisionstore: Bytes::split_at -> Bytes::slice
Summary: Going to migrate from bytes to minibytes. Avoid using bytes' specific API.

Reviewed By: kulshrax

Differential Revision: D26218292

fbshipit-source-id: c69c2a1e0d1bde37f49e7ad542bf5e952deebb7a
2021-02-03 20:22:31 -08:00
Jun Wu
a75e25d756 revisionstore: bytes::ByteMut -> Vec::<u8>
Summary: We're going to drop dependency on `bytes`.

Reviewed By: kulshrax

Differential Revision: D26218291

fbshipit-source-id: fcb58bfae3e80c37e2a3c7df2a2ca73c8266c70b
2021-02-03 20:22:30 -08:00
Durham Goode
88900aaf93 dynamicconfig: remove legacylist and disallowedlist deprecation logic
Summary:
The original migration strategy with dynamicconfig was to fix configs
one by one until the dynamicconfig values matched the chef/static ones, then we
can turn off chef/static configs. This looks to be too much work, so we're going
to try a different strategy of just turning off all chef/static configs on a
small number of hosts and seeing what breaks.

The legacylist and disallowlist configs were part of the old strategy, and they
make it more complicated to fix dynamicconfig mismatches, so let's get rid of
them.

Reviewed By: quark-zju

Differential Revision: D26208548

fbshipit-source-id: 63171f1f16aa0498c0eefa994dffaeb8e0cc0d72
2021-02-03 09:53:00 -08:00
Andrey Chursin
c890d2a322 checkout: update exec flag
Summary: Metadata update happens in parallel with blob fetch and content update

Reviewed By: quark-zju

Differential Revision: D26213197

fbshipit-source-id: 45ca20106123e1b6cb85d1dda2f3effa0748cf20
2021-02-02 23:14:34 -08:00
Andrey Chursin
9a89bd4057 vfs: add set_executable api
Summary: set_executable is a pub function of VFS that set exec permissions on simple file

Reviewed By: quark-zju

Differential Revision: D26212713

fbshipit-source-id: 4c3ef477fc8d61362285654dda0b006342e046ee
2021-02-02 23:14:34 -08:00
Andrey Chursin
199f1cc1b9 checkout: basic implementation for file removal
Reviewed By: quark-zju

Differential Revision: D26212172

fbshipit-source-id: 2d3d8c79023b1dfd069c9cc7b759362e3bfc24ae
2021-02-02 23:14:34 -08:00
Andrey Chursin
45e4a30651 checkout: basic CheckoutPlan::apply implementation
Summary:
Basic implementation only process file updates for now.
See todos on CheckoutPlan::apply for more detail

Reviewed By: quark-zju

Differential Revision: D26209984

fbshipit-source-id: fcfbf568359d553a51ea02ea194634048d093d0e
2021-02-02 23:14:34 -08:00
Andrey Chursin
21360d6075 remove fbcode_only from revisionstore
Reviewed By: quark-zju

Differential Revision: D26210868

fbshipit-source-id: 694cd7155c08561cc1a6a6ad6a3fbe01f5847cf5
2021-02-02 23:14:33 -08:00
Andrey Chursin
3992818136 checkout: split updates with and without content fetch
Summary: This is needed becase later during checkout list of updates that needs fetch will go into storage stream

Reviewed By: quark-zju

Differential Revision: D26209983

fbshipit-source-id: 9fb54d48c6f0afc4fb67320aafc2e981c96ab5a9
2021-02-02 23:14:33 -08:00
Jun Wu
290257aea5 dag: expose LazySet::from_stream API
Summary:
Expose the async LazySet API via NameSet constructor so users won't need to
care about the LazySet type.

Reviewed By: sfilipco

Differential Revision: D26142170

fbshipit-source-id: 178383684981e81e43f2a5610c45a7ebbd354ab4
2021-02-02 19:58:31 -08:00
Jun Wu
92e1c70f2b dev-logger: traced(func) -> [log] for testing purpose
Summary:
Add a way to capture tracing output in tests to verify certain logs are
emitted.

Reviewed By: sfilipco

Differential Revision: D26142174

fbshipit-source-id: 9267ffbe413973b8c54c54db75fe037c05614b1a
2021-02-02 16:39:46 -08:00
Jun Wu
324f47b1f0 dev-logger: switch to tracing_subscriber
Summary:
`tracing_subscriber` has a fmt subscriber that satisfies the "log to stderr in
tests" need. It does not depend on `env_logger` or `TracingData` forwarding to
`env_logger`.

Reviewed By: sfilipco

Differential Revision: D26142175

fbshipit-source-id: 6e7dcd1585cb8431855322493d93bc49a8d57b76
2021-02-02 16:31:47 -08:00
Durham Goode
13de9f801a doctor: repair treemanifest indexedlogs as well
Summary: Previously we only repaired the file indexedlogs.

Reviewed By: xavierd

Differential Revision: D26202423

fbshipit-source-id: b1c673ae69a357d66ab2baf5c36985a3b0597427
2021-02-02 16:21:01 -08:00
Andrey Chursin
6be082f3bd checkout: implement CheckoutPlan::from_diff
Reviewed By: quark-zju

Differential Revision: D26191428

fbshipit-source-id: d26dd58a1bd9a3bab27f38abbd15f0405c646294
2021-02-02 15:34:33 -08:00
Andrey Chursin
a0fd97854b checkout: data structure for CheckoutPlan
Reviewed By: quark-zju

Differential Revision: D26189792

fbshipit-source-id: 9afa1682055d088e5c6e4c166f73d6e0b836806a
2021-02-02 15:34:32 -08:00