Summary: The implemenation is based on `range`.
Reviewed By: sfilipco
Differential Revision: D17002967
fbshipit-source-id: f59e1686306b9fc08dbca9891c2b6d6c42be2717
Summary:
Previously, `SyncableDag` and `Dag` can co-exist. Dropping SyncableDag involves
error handling and is not panic-free. If we want to make sure `Dag` has complete
high-level segments, then it would have been implemented in `SyncableDag::drop`,
making it more sensitive to panic.
Change the API so `SyncableDag` is independent from `Dag`, so `Dag` always
has complete segments, and changes to `SyncableDag` are invisible to `Dag`,
so `SyncableDag` cannot mess up existing `Dag` structures.
Reviewed By: sfilipco
Differential Revision: D17000969
fbshipit-source-id: 1ceed4ea335d3d64848b7430d48076846b90695d
Summary:
Previously, the `Dag` has 2 low-level `build_segemnts` APIs:
- Dag::build_flat_segments(..., last_threshold)
- Dag::build_high_level_segments(..., drop_last)
They allow customization about whether the segments are lagging or not.
However, certain algorithms (ex. children and range) now require the high level
segments to cover everything covered by the flat segments. The above APIs
wouldn't ensure that.
This diff refactors the segment building APIs so that:
- Make `build_flat_segments`, and `build_high_level_segments` private to
prevent misuse.
- Ensure high level segments cover flat segments at `Dag::open` and
`Dag::build_segments_volatile`, the only ways to change `Dag`.
- Provide different APIs suitable for different (one-time in-memory vs
on-disk) use-cases. The on-disk `build_segments_persistent` API makes high
level segments lagging to avoid fragmentation, while the in-memory
`build_segments_volatile` does not.
To satisfy the existing test need, a `set_segment_size` API was added to
override the default segment size.
Most callsites become simpler because they no longer need to figure out
details about segment size, level, and lagging.
Reviewed By: sfilipco
Differential Revision: D17000965
fbshipit-source-id: 78bb0c7674c99e91be6011bb7e623cd4f63b1521
Summary:
Parents are ordered and the order can be important. The flat segments preserve
the order but there are no APIs exposing the parent order. Define one.
Reviewed By: markbt
Differential Revision: D17000966
fbshipit-source-id: 66beb53d9cef651a53391707c0b690a1e3b76ce2
Summary:
The children operation is now O(flat segments) = O(merges). But it has
potential to be faster with more precalculated information in segments.
See added comments for details.
Reviewed By: markbt
Differential Revision: D16976383
fbshipit-source-id: 80bfd2cefa5aa5ceabfd7e40d46d06f7e2b64d34
Summary:
This will guide optimizations.
Right now, gca_one "large sets" can take forever to run.
The code to build the mozilla DAG was extracted to a single file to be sharable.
Reviewed By: sfilipco
Differential Revision: D16992730
fbshipit-source-id: 1538f5b0098cd06cb179bd556df285055e1d62b6