Commit Graph

7 Commits

Author SHA1 Message Date
Jun Wu
64db96a4b7 indexedlog: make IndexDef clone-able
Summary:
It's hard to clone a `Fn`. But `fn` can be cloned. Change the API to use `fn`
instead.

Cloning `IndexDef` allows the same index definition to be used by multiple
Logs. It's used by upcoming diffs.

Differential Revision: D14688181

fbshipit-source-id: 6fda03a5f744dc90ee5d7ad3f36c243602f33510
2019-03-30 08:59:13 -07:00
Mark Thomas
6d84ff8825 mutation: create mutation store entries for local commits
Summary:
Computing mutation entries for all local commits is expensive when there are
lots of local draft commits.  Ideally we would have an indexed changelog that
would make these lookups fast, but until we have that, put entries in the
mutation store for these commits to take advantage of the fast lookup there.

Reviewed By: quark-zju

Differential Revision: D14566782

fbshipit-source-id: cc3a05715337a510a65d8ff436c59d16d0f0447e
2019-03-27 04:49:12 -07:00
Jun Wu
1348cf45f5 indexedlog: make fields in IndexDef private
Summary:
Change fields in IndexDef to private. Provide a public constructor method and
switch users to use that instead. This makes it possible to change the IndexDef
struct in the future (ex. having extra optional fields about whether the index
is backed by radix tree or something different).

Differential Revision: D14608955

fbshipit-source-id: 62a413268d97ba96b2c4efd2ce67cd4fa0ff4293
2019-03-26 21:19:46 -07:00
Mark Thomas
ac64b2c858 mutationstore: use new location for ChaChaRng
Summary:
The ChaCha RNG has moved from `rand` to `rand_chacha`.  Use the new location to
prevent the deprecation warning.

Reviewed By: quark-zju

Differential Revision: D14596397

fbshipit-source-id: e082369d4cf2d4ab42eb37df83a2627b937dcf62
2019-03-25 14:07:58 -07:00
Mark Thomas
05fdc3c37f mutationstore: apply latest rustfmt
Reviewed By: quark-zju

Differential Revision: D14596405

fbshipit-source-id: 43cc962db9cbc06ea0bfcf4041cd191ef1f1bc2e
2019-03-25 14:07:57 -07:00
Mark Thomas
3b9eb801e1 types: use Fallible
Summary:
Use the `Fallible` type alias provided by `failure` rather than defining our
own.

Differential Revision: D13657313

fbshipit-source-id: ae249bc15037cc2be019ce7ce8a440c153aa31cc
2019-01-15 03:50:47 -08:00
Mark Thomas
cf4b52c19c mutationstore: add mutationstore
Summary:
The mutationstore is a new store for recording records of commit mutations for
commits that are not in the local repository.

It uses an indexedlog to store the data.  Each mutation entry corresponds to
the information the mutation that led to the creation of a particular commit,
which is recorded as the successor in the entry.

Entries can come from three possible places:

* `Commit` metadata for a commit not available locally
* `Obsmarkers` for repos that have been migrated from evolution tracking
* `Synthetic` for entries created synthetically, e.g. by a pullcreatemarkers
  implementation.

The other commits referred to in an entry must predate the successor commit.
For entries that originated from commits, this is ensured, as the successor
commit hash includes the other commit hashes.  For other entry types, it is
an error to refer to later commits, and any entry that causes a cycle will
be ignored.

Reviewed By: quark-zju

Differential Revision: D12980773

fbshipit-source-id: 040d3f7369a113e710ed8c9f61fabec6c5ec9258
2018-12-14 06:43:40 -08:00