BewareMyPower commented on code in PR #984:
URL: https://github.com/apache/pulsar-client-go/pull/984#discussion_r1147212777


##########
pulsar/transaction.go:
##########
@@ -17,7 +17,53 @@
 
 package pulsar
 
+import (
+       "context"
+)
+
+// TxnState The state of the transaction. Check the state of the transaction 
before executing some operation
+// with the transaction is necessary.
+type TxnState int32
+
+const (
+       _ TxnState = iota
+       // Open The transaction in Open state can be used to send/ack messages.
+       Open
+       // Committing The state of the transaction will be Committing after the 
commit method is called.
+       // The transaction in Committing state can be committed again.
+       Committing
+       // Aborting The state of the transaction will be Aborting after the 
abort method is called.
+       // The transaction in Aborting state can be aborted again.
+       Aborting
+       // Committed The state of the transaction will be Committed after the 
commit method is executed success.
+       // This means that all the operations with the transaction are success.
+       Committed
+       // Aborted The state of the transaction will be Aborted after the abort 
method is executed success.
+       // This means that all the operations with the transaction are aborted.
+       Aborted
+       // Errored The state of the transaction will be Errored after the 
operation of transaction get a non-retryable error.
+       Errored

Review Comment:
   > The Error is a conflict with Error in error.go.
   
   Okay. Then I think it's better to add a prefix to these enum constants. e.g. 
`TxnState_Open`, `TxnState_Error`. Otherwise, it could be very easy to cause 
the naming conflicts. You can also see the generated code in `PulsarApi.pb.go`, 
the enum constants all have their prefixes like `CompressionType_` and 
`ProducerAccessMode_`.



-- 
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]

Reply via email to