CTTY commented on code in PR #1400:
URL: https://github.com/apache/iceberg-rust/pull/1400#discussion_r2131433406


##########
crates/iceberg/src/transaction/action/mod.rs:
##########
@@ -0,0 +1,67 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::sync::Arc;
+
+use async_trait::async_trait;
+
+use crate::transaction::Transaction;
+use crate::{Error, ErrorKind, Result, TableRequirement, TableUpdate};
+
+pub type BoxedTransactionAction = Arc<dyn TransactionAction>;
+
+#[async_trait]
+pub(crate) trait TransactionAction: Sync + Send {
+    /// Commit the changes and apply the changes to the transaction,
+    /// return the transaction with the updated current_table
+    fn commit(self: Arc<Self>, tx: &mut Transaction) -> Result<()>;

Review Comment:
   After some thoughts, maybe it's better to keep it `async fn commit(self: 
Arc<Self>, tx: &mut Transcation)`? Here is why I'm hesitant:
   - `Transaction` needs to keep track of `current_table`(staging table), 
`updates`(updates that have been applied to the staged table), and 
`requirements` (for the staged table). Because when applying changes to the 
staging table, Transaction can easily check what has already been applied if 
needed ([like 
this](https://github.com/apache/iceberg-rust/blob/b5b8aa837ef70a25c6589d4faa6a358371e35482/crates/iceberg/src/transaction/mod.rs#L85))
   
   An alternative would be storing `updates` and `requirements` in the `Table`, 
but I'm not sure if it makes sense to move these tx-related concepts/logic to 
`Table`. wdyt?



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to