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
36 lines
1.2 KiB
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,
|
|
}
|
|
}
|
|
|