You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/02 06:25:33 UTC

[GitHub] [pulsar] codelipenghui commented on a diff in pull request #17423: [improve][txn] Add getState in transaction for client API

codelipenghui commented on code in PR #17423:
URL: https://github.com/apache/pulsar/pull/17423#discussion_r961326248


##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/transaction/Transaction.java:
##########
@@ -29,6 +29,16 @@
 @InterfaceStability.Evolving
 public interface Transaction {
 
+    enum State {
+        OPEN,
+        COMMITTING,
+        ABORTING,
+        COMMITTED,
+        ABORTED,
+        ERROR,
+        TIMEOUT

Review Comment:
   ```suggestion
           TIMED_OUT
   ```



##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/transaction/Transaction.java:
##########
@@ -48,4 +58,12 @@ public interface Transaction {
      *  @return {@link TxnID} the txnID.
      */
     TxnID getTxnID();
+
+    /**
+     * Get transaction state.
+     *
+     * @return {@link State} the state of the transaction.
+     */
+    State getTxnState();

Review Comment:
   ```suggestion
       State getState();
   ```



##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/transaction/TransactionImpl.java:
##########
@@ -215,6 +205,11 @@ public TxnID getTxnID() {
         return new TxnID(txnIdMostBits, txnIdLeastBits);
     }
 
+    @Override
+    public State getTxnState() {

Review Comment:
   ```suggestion
       public State getState() {
   ```



##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/transaction/Transaction.java:
##########
@@ -29,6 +29,16 @@
 @InterfaceStability.Evolving
 public interface Transaction {
 
+    enum State {
+        OPEN,
+        COMMITTING,
+        ABORTING,
+        COMMITTED,
+        ABORTED,
+        ERROR,

Review Comment:
   It's better to add a document for `ERROR`
   Or can we rename it to `FAILED`?



-- 
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: commits-unsubscribe@pulsar.apache.org

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