本文整理匯總了Golang中github.com/youtube/vitess/go/vt/hook.Hook.Execute方法的典型用法代碼示例。如果您正苦於以下問題:Golang Hook.Execute方法的具體用法?Golang Hook.Execute怎麽用?Golang Hook.Execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/vt/hook.Hook
的用法示例。
在下文中一共展示了Hook.Execute方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExecuteHook
// ExecuteHook executes the provided hook locally, and returns the result.
func (agent *ActionAgent) ExecuteHook(ctx context.Context, hk *hook.Hook) *hook.HookResult {
if err := agent.lock(ctx); err != nil {
// client gave up
return &hook.HookResult{}
}
defer agent.unlock()
// Execute the hooks
topotools.ConfigureTabletHook(hk, agent.TabletAlias)
hr := hk.Execute()
// We never know what the hook did, so let's refresh our state.
if err := agent.refreshTablet(ctx, "ExecuteHook"); err != nil {
log.Errorf("refreshTablet after ExecuteHook failed: %v", err)
}
return hr
}
示例2: ExecuteHook
// ExecuteHook executes the provided hook locally, and returns the result.
// Should be called under RPCWrapLockAction.
func (agent *ActionAgent) ExecuteHook(ctx context.Context, hk *hook.Hook) *hook.HookResult {
topotools.ConfigureTabletHook(hk, agent.TabletAlias)
return hk.Execute()
}