You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

branch_status.go 2.4 kB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package meta
  2. import "fmt"
  3. type BranchStatus byte
  4. const (
  5. /**
  6. * The BranchStatus_Unknown.
  7. * description:BranchStatus_Unknown branch status.
  8. */
  9. BranchStatusUnknown BranchStatus = iota
  10. /**
  11. * The BranchStatus_Registered.
  12. * description:BranchStatus_Registered to TC.
  13. */
  14. BranchStatusRegistered
  15. /**
  16. * The Phase one done.
  17. * description:Branch logic is successfully done at phase one.
  18. */
  19. BranchStatusPhaseoneDone
  20. /**
  21. * The Phase one failed.
  22. * description:Branch logic is failed at phase one.
  23. */
  24. BranchStatusPhaseoneFailed
  25. /**
  26. * The Phase one timeout.
  27. * description:Branch logic is NOT reported for a timeout.
  28. */
  29. BranchStatusPhaseoneTimeout
  30. /**
  31. * The Phase two committed.
  32. * description:Commit logic is successfully done at phase two.
  33. */
  34. BranchStatusPhasetwoCommitted
  35. /**
  36. * The Phase two commit failed retryable.
  37. * description:Commit logic is failed but retryable.
  38. */
  39. BranchStatusPhasetwoCommitFailedRetryable
  40. /**
  41. * The Phase two commit failed unretryable.
  42. * description:Commit logic is failed and NOT retryable.
  43. */
  44. BranchStatusPhasetwoCommitFailedUnretryable
  45. /**
  46. * The Phase two rollbacked.
  47. * description:Rollback logic is successfully done at phase two.
  48. */
  49. BranchStatusPhasetwoRollbacked
  50. /**
  51. * The Phase two rollback failed retryable.
  52. * description:Rollback logic is failed but retryable.
  53. */
  54. BranchStatusPhasetwoRollbackFailedRetryable
  55. /**
  56. * The Phase two rollback failed unretryable.
  57. * description:Rollback logic is failed but NOT retryable.
  58. */
  59. BranchStatusPhasetwoRollbackFailedUnretryable
  60. )
  61. func (s BranchStatus) String() string {
  62. switch s {
  63. case BranchStatusUnknown:
  64. return "Unknown"
  65. case BranchStatusRegistered:
  66. return "Registered"
  67. case BranchStatusPhaseoneDone:
  68. return "PhaseoneDone"
  69. case BranchStatusPhaseoneFailed:
  70. return "PhaseoneFailed"
  71. case BranchStatusPhaseoneTimeout:
  72. return "PhaseoneTimeout"
  73. case BranchStatusPhasetwoCommitted:
  74. return "PhasetwoCommitted"
  75. case BranchStatusPhasetwoCommitFailedRetryable:
  76. return "PhasetwoCommitFailedRetryable"
  77. case BranchStatusPhasetwoCommitFailedUnretryable:
  78. return "CommitFailedUnretryable"
  79. case BranchStatusPhasetwoRollbacked:
  80. return "PhasetwoRollbacked"
  81. case BranchStatusPhasetwoRollbackFailedRetryable:
  82. return "RollbackFailedRetryable"
  83. case BranchStatusPhasetwoRollbackFailedUnretryable:
  84. return "RollbackFailedUnretryable"
  85. default:
  86. return fmt.Sprintf("%d", s)
  87. }
  88. }

Go Implementation For Seata