diff --git a/eden/scm/lib/hgcommits/src/doublewrite.rs b/eden/scm/lib/hgcommits/src/doublewrite.rs index 2e11635b87..0cc69c5893 100644 --- a/eden/scm/lib/hgcommits/src/doublewrite.rs +++ b/eden/scm/lib/hgcommits/src/doublewrite.rs @@ -6,6 +6,7 @@ */ use crate::AppendCommits; +use crate::DescribeBackend; use crate::HgCommit; use crate::HgCommits; use crate::ReadCommitText; @@ -165,3 +166,31 @@ impl ToSet for DoubleWriteCommits { self.commits.to_set(set) } } + +impl DescribeBackend for DoubleWriteCommits { + fn algorithm_backend(&self) -> &'static str { + "segments" + } + + fn describe_backend(&self) -> String { + format!( + r#"Backend (doublewrite): + Local: + Segments + IdMap: {} + Zstore: {} + Revlog + Nodemap: {} +Feature Providers: + Commit Graph Algorithms: + Segments + Commit Hash / Rev Lookup: + IdMap + Commit Data (user, message): + Zstore (incomplete) + Revlog +"#, + self.commits.dag_path.display(), + self.commits.commits_path.display(), + self.revlog.dir.join("00changelog.{i,d,nodemap}").display(), + ) + } +} diff --git a/eden/scm/lib/hgcommits/src/hgsha1commits.rs b/eden/scm/lib/hgcommits/src/hgsha1commits.rs index a859f48131..3874418d09 100644 --- a/eden/scm/lib/hgcommits/src/hgsha1commits.rs +++ b/eden/scm/lib/hgcommits/src/hgsha1commits.rs @@ -7,6 +7,7 @@ use crate::strip; use crate::AppendCommits; +use crate::DescribeBackend; use crate::HgCommit; use crate::ReadCommitText; use crate::StripCommits; @@ -37,9 +38,9 @@ use zstore::Zstore; /// Commits using the HG SHA1 hash function. Stored on disk. pub struct HgCommits { commits: Zstore, - commits_path: PathBuf, + pub(crate) commits_path: PathBuf, dag: Dag, - dag_path: PathBuf, + pub(crate) dag_path: PathBuf, } impl HgCommits { @@ -238,3 +239,28 @@ impl ToSet for HgCommits { self.dag.to_set(set) } } + +impl DescribeBackend for HgCommits { + fn algorithm_backend(&self) -> &'static str { + "segments" + } + + fn describe_backend(&self) -> String { + format!( + r#"Backend (non-lazy segments): + Local: + Segments + IdMap: {} + Zstore: {} +Feature Providers: + Commit Graph Algorithms: + Segments + Commit Hash / Rev Lookup: + IdMap + Commit Data (user, message): + Zstore +"#, + self.dag_path.display(), + self.commits_path.display() + ) + } +} diff --git a/eden/scm/lib/hgcommits/src/lib.rs b/eden/scm/lib/hgcommits/src/lib.rs index 8c13351c5a..93801d2b16 100644 --- a/eden/scm/lib/hgcommits/src/lib.rs +++ b/eden/scm/lib/hgcommits/src/lib.rs @@ -28,6 +28,14 @@ pub trait AppendCommits { fn flush(&mut self, master_heads: &[Vertex]) -> Result<()>; } +pub trait DescribeBackend { + /// Name of the DagAlgorithm backend. + fn algorithm_backend(&self) -> &'static str; + + /// Describe what storage backend is being used. + fn describe_backend(&self) -> String; +} + /// Parameter used by `add_commits`. #[derive(Clone, Debug, Serialize, Deserialize)] pub struct HgCommit { diff --git a/eden/scm/lib/hgcommits/src/memhgcommits.rs b/eden/scm/lib/hgcommits/src/memhgcommits.rs index 3705df7db1..c6dd80b2c8 100644 --- a/eden/scm/lib/hgcommits/src/memhgcommits.rs +++ b/eden/scm/lib/hgcommits/src/memhgcommits.rs @@ -7,6 +7,7 @@ use crate::strip; use crate::AppendCommits; +use crate::DescribeBackend; use crate::HgCommit; use crate::ReadCommitText; use crate::StripCommits; @@ -189,3 +190,24 @@ impl ToSet for MemHgCommits { self.dag.to_set(set) } } + +impl DescribeBackend for MemHgCommits { + fn algorithm_backend(&self) -> &'static str { + "segments" + } + + fn describe_backend(&self) -> String { + r#"Backend (memory): + Local: + Memory +Feature Providers: + Commit Graph Algorithms: + Memory + Commit Hash / Rev Lookup: + Memory + Commit Data (user, message): + Memory +"# + .to_string() + } +} diff --git a/eden/scm/lib/hgcommits/src/revlog.rs b/eden/scm/lib/hgcommits/src/revlog.rs index 0970ba78ee..b49dcf7fc7 100644 --- a/eden/scm/lib/hgcommits/src/revlog.rs +++ b/eden/scm/lib/hgcommits/src/revlog.rs @@ -7,6 +7,7 @@ use crate::strip; use crate::AppendCommits; +use crate::DescribeBackend; use crate::HgCommit; use crate::ReadCommitText; use crate::StripCommits; @@ -30,7 +31,7 @@ use std::path::PathBuf; /// HG commits stored on disk using the revlog format. pub struct RevlogCommits { revlog: RevlogIndex, - dir: PathBuf, + pub(crate) dir: PathBuf, } impl RevlogCommits { @@ -179,3 +180,28 @@ impl ToSet for RevlogCommits { self.revlog.to_set(set) } } + +impl DescribeBackend for RevlogCommits { + fn algorithm_backend(&self) -> &'static str { + "revlog" + } + + fn describe_backend(&self) -> String { + format!( + r#"Backend (revlog): + Local: + Revlog: {} + Nodemap: {} +Feature Providers: + Commit Graph Algorithms: + Revlog + Commit Hash / Rev Lookup: + Nodemap + Commit Data (user, message): + Revlog +"#, + self.dir.join("00changelog.{i,d}").display(), + self.dir.join("00changelog.nodemap").display(), + ) + } +}