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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 exec
  18. import (
  19. "time"
  20. )
  21. const (
  22. // TMENDICANT Ends a recovery scan.
  23. TMENDRSCAN = 0x00800000
  24. /**
  25. * Disassociates the caller and marks the transaction branch
  26. * rollback-only.
  27. */
  28. TMFAIL = 0x20000000
  29. /**
  30. * Caller is joining existing transaction branch.
  31. */
  32. TMJOIN = 0x00200000
  33. /**
  34. * Use TMNOFLAGS to indicate no flags value is selected.
  35. */
  36. TMNOFLAGS = 0x00000000
  37. /**
  38. * Caller is using one-phase optimization.
  39. */
  40. TMONEPHASE = 0x40000000
  41. /**
  42. * Caller is resuming association with a suspended
  43. * transaction branch.
  44. */
  45. TMRESUME = 0x08000000
  46. /**
  47. * Starts a recovery scan.
  48. */
  49. TMSTARTRSCAN = 0x01000000
  50. /**
  51. * Disassociates caller from a transaction branch.
  52. */
  53. TMSUCCESS = 0x04000000
  54. /**
  55. * Caller is suspending (not ending) its association with
  56. * a transaction branch.
  57. */
  58. TMSUSPEND = 0x02000000
  59. /**
  60. * The transaction branch has been read-only and has been committed.
  61. */
  62. XA_RDONLY = 0x00000003
  63. /**
  64. * The transaction work has been prepared normally.
  65. */
  66. XA_OK = 0
  67. )
  68. type XAResource interface {
  69. Commit(xid string, onePhase bool) error
  70. End(xid string, flags int) error
  71. Forget(xid string) error
  72. GetTransactionTimeout() time.Duration
  73. IsSameRM(resource XAResource) bool
  74. XAPrepare(xid string) error
  75. Recover(flag int) ([]string, error)
  76. Rollback(xid string) error
  77. SetTransactionTimeout(duration time.Duration) bool
  78. Start(xid string, flags int) error
  79. }