diff rust/hg-core/src/dirstate_tree/owning.rs @ 50243:6cce0afc1454 stable

rust-dirstate: remember the data file uuid dirstate was loaded with This will be used in the next patch to fix a race condition.
author Rapha?l Gom?s <rgomes@octobus.net>
date Mon, 12 Dec 2022 17:08:12 +0100
parents dd6b67d5c256
children dbe09fb038fc
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/owning.rs	Wed Mar 01 02:38:20 2023 +0100
+++ b/rust/hg-core/src/dirstate_tree/owning.rs	Mon Dec 12 17:08:12 2022 +0100
@@ -57,6 +57,7 @@
         on_disk: OnDisk,
         data_size: usize,
         metadata: &[u8],
+        uuid: Vec<u8>,
     ) -> Result<Self, DirstateError>
     where
         OnDisk: Deref<Target = [u8]> + Send + 'static,
@@ -66,7 +67,7 @@
         OwningDirstateMapTryBuilder {
             on_disk,
             map_builder: |bytes| {
-                DirstateMap::new_v2(&bytes, data_size, metadata)
+                DirstateMap::new_v2(&bytes, data_size, metadata, uuid)
             },
         }
         .try_build()
@@ -86,4 +87,12 @@
     pub fn on_disk(&self) -> &[u8] {
         self.borrow_on_disk()
     }
+
+    pub fn old_uuid(&self) -> Option<&[u8]> {
+        self.get_map().old_uuid.as_deref()
+    }
+
+    pub fn old_data_size(&self) -> usize {
+        self.get_map().old_data_size
+    }
 }