-
Notifications
You must be signed in to change notification settings - Fork 268
feat(transaction): Add TransactionAction and related classes #1420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @CTTY for this pr, generally looks good! Just some minor suggestions.
fn apply(self, tx: Transaction) -> Result<Transaction>; | ||
} | ||
|
||
impl<T: TransactionAction + 'static> ApplyTransactionAction for T { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this apply
will have different implementation? If not, maybe we can provide a "apply" function in Transaction directly, like:
let action1 ...
let action2 ...
let tx = Transaction::new(&table);
tx.apply(action1).apply(action2)..
Looks like these two method implement the same effect and just a function in Transaction maybe more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an auto implementation and will be apply to all transaction actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enables fluent api call like this:
let mut tx = action.add_file("x1")
.add_file("x2")
.apply(tx);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @CTTY , LGTM!
Let's wait for a while to see if others have concerns. |
Which issue does this PR close?
This is a part of the effort to refactor transaction commit path and enable retry for write operations.
Please find the POC here: #1400
Related Issues:
Transaction::commit
method #1387TableMetadata
to new location. #1388What changes are included in this PR?
TransactionAction
,ActionCommit
, andApplyTransactionAction
actions
field inTransaction
Are these changes tested?
Added unit tests