dojiong commented on code in PR #1941:
URL: https://github.com/apache/iceberg-rust/pull/1941#discussion_r2629454990


##########
crates/iceberg/src/arrow/delete_filter.rs:
##########
@@ -82,6 +107,39 @@ impl DeleteFilter {
         Some(notifier)
     }
 
+    /// Attempts to mark a positional delete file as "loading".
+    ///
+    /// Returns an action dictating whether the caller should load the file,
+    /// wait for another task to load it, or do nothing.
+    pub(crate) fn try_start_pos_del_load(&self, file_path: &str) -> 
PosDelLoadAction {
+        let mut state = self.state.write().unwrap();
+
+        if let Some(state) = state.positional_deletes.get(file_path) {
+            match state {
+                PosDelState::Loaded => return PosDelLoadAction::AlreadyLoaded,
+                PosDelState::Loading(notify) => return 
PosDelLoadAction::WaitFor(notify.clone()),
+            }
+        }
+
+        let notifier = Arc::new(Notify::new());
+        state
+            .positional_deletes
+            .insert(file_path.to_string(), PosDelState::Loading(notifier));
+
+        PosDelLoadAction::Load
+    }
+
+    /// Marks a positional delete file as successfully loaded and notifies any 
waiting tasks.
+    pub(crate) fn finish_pos_del_load(&self, file_path: &str) {
+        let mut state = self.state.write().unwrap();
+        if let Some(PosDelState::Loading(notify)) = state
+            .positional_deletes
+            .insert(file_path.to_string(), PosDelState::Loaded)
+        {
+            notify.notify_waiters();

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to