mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-12 21:02:41 +01:00
37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
|
package themis
|
||
|
|
||
|
// Hooks for debugging and testing
|
||
|
type fnHook func(txn *themisTxn, ctx interface{}) (bypass bool, ret interface{}, err error)
|
||
|
|
||
|
var emptyHookFn = func(txn *themisTxn, ctx interface{}) (bypass bool, ret interface{}, err error) {
|
||
|
return true, nil, nil
|
||
|
}
|
||
|
|
||
|
type txnHook struct {
|
||
|
afterChoosePrimaryAndSecondary fnHook
|
||
|
beforePrewritePrimary fnHook
|
||
|
beforePrewriteLockClean fnHook
|
||
|
beforePrewriteSecondary fnHook
|
||
|
beforeCommitPrimary fnHook
|
||
|
beforeCommitSecondary fnHook
|
||
|
onSecondaryOccursLock fnHook
|
||
|
onPrewriteRow fnHook
|
||
|
onTxnSuccess fnHook
|
||
|
onTxnFailed fnHook
|
||
|
}
|
||
|
|
||
|
func newHook() *txnHook {
|
||
|
return &txnHook{
|
||
|
afterChoosePrimaryAndSecondary: emptyHookFn,
|
||
|
beforePrewritePrimary: emptyHookFn,
|
||
|
beforePrewriteLockClean: emptyHookFn,
|
||
|
beforePrewriteSecondary: emptyHookFn,
|
||
|
beforeCommitPrimary: emptyHookFn,
|
||
|
beforeCommitSecondary: emptyHookFn,
|
||
|
onSecondaryOccursLock: emptyHookFn,
|
||
|
onPrewriteRow: emptyHookFn,
|
||
|
onTxnSuccess: emptyHookFn,
|
||
|
onTxnFailed: emptyHookFn,
|
||
|
}
|
||
|
}
|