sapling/eden/scm/lib/mutationstore/Cargo.toml
Jun Wu 4f39a8e5a6 mutationstore: add a method that returns a dag
Summary:
Part of the mutation graph (excluding split and fold) can fit in the DAG
abstraction. Add a method to do that. This allows cross-dag calculations
like:

  changelogdag = ... # suppose available by segmented changelog

  # mutdag and changelogdag are independent (might have different nodes),
  # with full DAG operations on either of them.
  mutdag = mutation.getdag(...)
  mutdag.heads(mutdag.descendants([node])) & changelogdag.descendants([node2]) # now possible

Comparing to the current situation, this has some advantages:
- No need to couple the "visibility", "filtered node" logic to the mutation
  layer. The unknown nodes can be filtered out naturally by a set "&"
  operation.
- DAG operations like heads, roots can be performed on mutdag when it's
  previously impossible. We also get operations like visualization for free.

There are some limitations, though:
- The DAG cannot represent non 1:1 modifications (fold, split) losslessly.
  Those relationships are simply ignored for now.
- The MemNameDag is not lazy. Reading a long chain of amends might be slow.
  For most normal use-cases it is probably okay. If it becomes an issue we
  can seek for other solutions, for example, store part of mutationstore
  directly in a DAG format on disk, or have fast paths to bypass long
  predecessor chain calculation.

Reviewed By: DurhamG

Differential Revision: D21486521

fbshipit-source-id: 03624c8e9803eb1852b3034b8f245555ec582e85
2020-05-13 09:45:24 -07:00

21 lines
485 B
TOML

[package]
name = "mutationstore"
version = "0.1.0"
edition = "2018"
[dependencies]
anyhow = "1.0.20"
dag = { path = "../dag" }
indexedlog = { path = "../indexedlog" }
thiserror = "1.0.5"
types = { path = "../types" }
vlqencoding = { path = "../vlqencoding" }
[dev-dependencies]
drawdag = { path = "../drawdag" }
rand = "0.7"
rand_chacha = "0.2"
renderdag = { path = "../renderdag" }
tempdir = "0.3.7"
types = { path = "../types", default-features = false, features = ["for-tests"] }