diff rust/hg-core/src/revlog/filelog.rs @ 48540:20d0d896183e

rhg: Rename some revlog-related types and methods Use "data chunck" and "data" for a revlog entry?s data before and after resolving deltas (if any), repsectively. The former `FilelogEntry` actually only contains data, rename it to `FilelogRevisionData` accordingly. This leaves room to later have a `FilelogEntry` type that wraps `RevlogEntry`. Differential Revision: https://phab.mercurial-scm.org/D11959
author Simon Sapin <simon.sapin@octobus.net>
date Tue, 21 Dec 2021 15:57:30 +0100
parents e9faae0f445c
children f2f57724d4eb
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/filelog.rs	Wed Jan 05 13:36:05 2022 -0500
+++ b/rust/hg-core/src/revlog/filelog.rs	Tue Dec 21 15:57:30 2021 +0100
@@ -28,7 +28,7 @@
     pub fn data_for_node(
         &self,
         file_node: impl Into<NodePrefix>,
-    ) -> Result<FilelogEntry, RevlogError> {
+    ) -> Result<FilelogRevisionData, RevlogError> {
         let file_rev = self.revlog.rev_from_node(file_node.into())?;
         self.data_for_rev(file_rev)
     }
@@ -38,9 +38,9 @@
     pub fn data_for_rev(
         &self,
         file_rev: Revision,
-    ) -> Result<FilelogEntry, RevlogError> {
+    ) -> Result<FilelogRevisionData, RevlogError> {
         let data: Vec<u8> = self.revlog.get_rev_data(file_rev)?;
-        Ok(FilelogEntry(data.into()))
+        Ok(FilelogRevisionData(data.into()))
     }
 }
 
@@ -50,9 +50,10 @@
     get_path_from_bytes(&encoded_bytes).into()
 }
 
-pub struct FilelogEntry(Vec<u8>);
+/// The data for one revision in a filelog, uncompressed and delta-resolved.
+pub struct FilelogRevisionData(Vec<u8>);
 
-impl FilelogEntry {
+impl FilelogRevisionData {
     /// Split into metadata and data
     pub fn split(&self) -> Result<(Option<&[u8]>, &[u8]), HgError> {
         const DELIMITER: &[u8; 2] = &[b'\x01', b'\n'];
@@ -71,14 +72,14 @@
     }
 
     /// Returns the file contents at this revision, stripped of any metadata
-    pub fn data(&self) -> Result<&[u8], HgError> {
+    pub fn file_data(&self) -> Result<&[u8], HgError> {
         let (_metadata, data) = self.split()?;
         Ok(data)
     }
 
     /// Consume the entry, and convert it into data, discarding any metadata,
     /// if present.
-    pub fn into_data(self) -> Result<Vec<u8>, HgError> {
+    pub fn into_file_data(self) -> Result<Vec<u8>, HgError> {
         if let (Some(_metadata), data) = self.split()? {
             Ok(data.to_owned())
         } else {