From patchwork Mon Jan 27 18:36:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7789: rust-revlog: a trait for the revlog index From: phabricator X-Patchwork-Id: 44695 Message-Id: <0d0d96c6a4f08494b09da69ddc854615@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Mon, 27 Jan 2020 18:36:46 +0000 Closed by commit rHG3fb39dc2e356: rust-revlog: a trait for the revlog index (authored by gracinet). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D7789?vs=19629&id=19642 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7789/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7789 AFFECTED FILES rust/hg-core/src/revlog.rs CHANGE DETAILS To: gracinet, #hg-reviewers, martinvonz Cc: martinvonz, durin42, kevincox, mercurial-devel diff --git a/rust/hg-core/src/revlog.rs b/rust/hg-core/src/revlog.rs --- a/rust/hg-core/src/revlog.rs +++ b/rust/hg-core/src/revlog.rs @@ -40,3 +40,17 @@ ParentOutOfRange(Revision), WorkingDirectoryUnsupported, } + +/// The Mercurial Revlog Index +/// +/// This is currently limited to the minimal interface that is needed for +/// the [`nodemap`](nodemap/index.html) module +pub trait RevlogIndex { + /// Total number of Revisions referenced in this index + fn len(&self) -> usize; + + /// Return a reference to the Node or `None` if rev is out of bounds + /// + /// `NULL_REVISION` is not considered to be out of bounds. + fn node(&self, rev: Revision) -> Option<&Node>; +}