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.

resource_xa.go 2.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package conn
  18. import "time"
  19. const (
  20. // TMENDICANT Ends a recovery scan.
  21. TMENDRSCAN = 0x00800000
  22. /**
  23. * Disassociates the caller and marks the transaction branch
  24. * rollback-only.
  25. */
  26. TMFAIL = 0x20000000
  27. /**
  28. * Caller is joining existing transaction branch.
  29. */
  30. TMJOIN = 0x00200000
  31. /**
  32. * Use TMNOFLAGS to indicate no flags value is selected.
  33. */
  34. TMNOFLAGS = 0x00000000
  35. /**
  36. * Caller is using one-phase optimization.
  37. */
  38. TMONEPHASE = 0x40000000
  39. /**
  40. * Caller is resuming association with a suspended
  41. * transaction branch.
  42. */
  43. TMRESUME = 0x08000000
  44. /**
  45. * Starts a recovery scan.
  46. */
  47. TMSTARTRSCAN = 0x01000000
  48. /**
  49. * Disassociates caller from a transaction branch.
  50. */
  51. TMSUCCESS = 0x04000000
  52. /**
  53. * Caller is suspending (not ending) its association with
  54. * a transaction branch.
  55. */
  56. TMSUSPEND = 0x02000000
  57. /**
  58. * The transaction branch has been read-only and has been committed.
  59. */
  60. XA_RDONLY = 0x00000003
  61. /**
  62. * The transaction work has been prepared normally.
  63. */
  64. XA_OK = 0
  65. )
  66. type XAResource interface {
  67. Commit(xid string, onePhase bool) error
  68. End(xid string, flags int) error
  69. Forget(xid string) error
  70. GetTransactionTimeout() time.Duration
  71. IsSameRM(resource XAResource) bool
  72. XAPrepare(xid string) (int, error)
  73. Recover(flag int) []string
  74. Rollback(xid string) error
  75. SetTransactionTimeout(duration time.Duration) bool
  76. Start(xid string, flags int) error
  77. }