本文整理汇总了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()
}