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

36 lines
1.2 KiB

  1. package themis
  2. // Hooks for debugging and testing
  3. type fnHook func(txn *themisTxn, ctx interface{}) (bypass bool, ret interface{}, err error)
  4. var emptyHookFn = func(txn *themisTxn, ctx interface{}) (bypass bool, ret interface{}, err error) {
  5. return true, nil, nil
  6. }
  7. type txnHook struct {
  8. afterChoosePrimaryAndSecondary fnHook
  9. beforePrewritePrimary fnHook
  10. beforePrewriteLockClean fnHook
  11. beforePrewriteSecondary fnHook
  12. beforeCommitPrimary fnHook
  13. beforeCommitSecondary fnHook
  14. onSecondaryOccursLock fnHook
  15. onPrewriteRow fnHook
  16. onTxnSuccess fnHook
  17. onTxnFailed fnHook
  18. }
  19. func newHook() *txnHook {
  20. return &txnHook{
  21. afterChoosePrimaryAndSecondary: emptyHookFn,
  22. beforePrewritePrimary: emptyHookFn,
  23. beforePrewriteLockClean: emptyHookFn,
  24. beforePrewriteSecondary: emptyHookFn,
  25. beforeCommitPrimary: emptyHookFn,
  26. beforeCommitSecondary: emptyHookFn,
  27. onSecondaryOccursLock: emptyHookFn,
  28. onPrewriteRow: emptyHookFn,
  29. onTxnSuccess: emptyHookFn,
  30. onTxnFailed: emptyHookFn,
  31. }
  32. }