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.

transaction.go 4.3 kB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. package protocal
  2. import (
  3. "github.com/dk-lockdown/seata-golang/meta"
  4. )
  5. type AbstractTransactionResponse struct {
  6. AbstractResultMessage
  7. TransactionExceptionCode meta.TransactionExceptionCode
  8. }
  9. type AbstractBranchEndRequest struct {
  10. Xid string
  11. BranchId int64
  12. BranchType meta.BranchType
  13. ResourceId string
  14. ApplicationData []byte
  15. }
  16. type AbstractBranchEndResponse struct {
  17. AbstractTransactionResponse
  18. Xid string
  19. BranchId int64
  20. BranchStatus meta.BranchStatus
  21. }
  22. type AbstractGlobalEndRequest struct {
  23. Xid string
  24. ExtraData []byte
  25. }
  26. type AbstractGlobalEndResponse struct {
  27. AbstractTransactionResponse
  28. GlobalStatus meta.GlobalStatus
  29. }
  30. type BranchRegisterRequest struct {
  31. Xid string
  32. BranchType meta.BranchType
  33. ResourceId string
  34. LockKey string
  35. ApplicationData []byte
  36. }
  37. func (req BranchRegisterRequest) GetTypeCode() int16 {
  38. return TypeBranchRegister
  39. }
  40. type BranchRegisterResponse struct {
  41. AbstractTransactionResponse
  42. BranchId int64
  43. }
  44. func (resp BranchRegisterResponse) GetTypeCode() int16 {
  45. return TypeBranchRegisterResult
  46. }
  47. type BranchReportRequest struct {
  48. Xid string
  49. BranchId int64
  50. ResourceId string
  51. Status meta.BranchStatus
  52. ApplicationData []byte
  53. BranchType meta.BranchType
  54. }
  55. func (req BranchReportRequest) GetTypeCode() int16 {
  56. return TypeBranchStatusReport
  57. }
  58. type BranchReportResponse struct {
  59. AbstractTransactionResponse
  60. }
  61. func (resp BranchReportResponse) GetTypeCode() int16 {
  62. return TypeBranchStatusReportResult
  63. }
  64. type BranchCommitRequest struct {
  65. AbstractBranchEndRequest
  66. }
  67. func (req BranchCommitRequest) GetTypeCode() int16 {
  68. return TypeBranchCommit
  69. }
  70. type BranchCommitResponse struct {
  71. AbstractBranchEndResponse
  72. }
  73. func (resp BranchCommitResponse) GetTypeCode() int16 {
  74. return TypeBranchCommitResult
  75. }
  76. type BranchRollbackRequest struct {
  77. AbstractBranchEndRequest
  78. }
  79. func (req BranchRollbackRequest) GetTypeCode() int16 {
  80. return TypeBranchRollback
  81. }
  82. type BranchRollbackResponse struct {
  83. AbstractBranchEndResponse
  84. }
  85. func (resp BranchRollbackResponse) GetTypeCode() int16 {
  86. return TypeGlobalRollbackResult
  87. }
  88. type GlobalBeginRequest struct {
  89. Timeout int32
  90. TransactionName string
  91. }
  92. func (req GlobalBeginRequest) GetTypeCode() int16 {
  93. return TypeGlobalBegin
  94. }
  95. type GlobalBeginResponse struct {
  96. AbstractTransactionResponse
  97. Xid string
  98. ExtraData []byte
  99. }
  100. func (resp GlobalBeginResponse) GetTypeCode() int16 {
  101. return TypeGlobalBeginResult
  102. }
  103. type GlobalStatusRequest struct {
  104. AbstractGlobalEndRequest
  105. }
  106. func (req GlobalStatusRequest) GetTypeCode() int16 {
  107. return TypeGlobalStatus
  108. }
  109. type GlobalStatusResponse struct {
  110. AbstractGlobalEndResponse
  111. }
  112. func (resp GlobalStatusResponse) GetTypeCode() int16 {
  113. return TypeGlobalStatusResult
  114. }
  115. type GlobalLockQueryRequest struct {
  116. BranchRegisterRequest
  117. }
  118. func (req GlobalLockQueryRequest) GetTypeCode() int16 {
  119. return TypeGlobalLockQuery
  120. }
  121. type GlobalLockQueryResponse struct {
  122. AbstractTransactionResponse
  123. Lockable bool
  124. }
  125. func (resp GlobalLockQueryResponse) GetTypeCode() int16 {
  126. return TypeGlobalLockQueryResult
  127. }
  128. type GlobalReportRequest struct {
  129. AbstractGlobalEndRequest
  130. GlobalStatus meta.GlobalStatus
  131. }
  132. func (req GlobalReportRequest) GetTypeCode() int16 {
  133. return TypeGlobalStatus
  134. }
  135. type GlobalReportResponse struct {
  136. AbstractGlobalEndResponse
  137. }
  138. func (resp GlobalReportResponse) GetTypeCode() int16 {
  139. return TypeGlobalStatusResult
  140. }
  141. type GlobalCommitRequest struct {
  142. AbstractGlobalEndRequest
  143. }
  144. func (req GlobalCommitRequest) GetTypeCode() int16 {
  145. return TypeGlobalCommit
  146. }
  147. type GlobalCommitResponse struct {
  148. AbstractGlobalEndResponse
  149. }
  150. func (resp GlobalCommitResponse) GetTypeCode() int16 {
  151. return TypeGlobalCommitResult
  152. }
  153. type GlobalRollbackRequest struct {
  154. AbstractGlobalEndRequest
  155. }
  156. func (req GlobalRollbackRequest) GetTypeCode() int16 {
  157. return TypeGlobalRollback
  158. }
  159. type GlobalRollbackResponse struct {
  160. AbstractGlobalEndResponse
  161. }
  162. func (resp GlobalRollbackResponse) GetTypeCode() int16 {
  163. return TypeGlobalRollbackResult
  164. }
  165. type UndoLogDeleteRequest struct {
  166. ResourceId string
  167. SaveDays int16
  168. BranchType meta.BranchType
  169. }
  170. func (req UndoLogDeleteRequest) GetTypeCode() int16 {
  171. return TypeRmDeleteUndolog
  172. }

Go Implementation For Seata