当前位置: 首页>>代码示例>>Golang>>正文


Golang topotools.ConfigureTabletHook函数代码示例

本文整理汇总了Golang中github.com/youtube/vitess/go/vt/topotools.ConfigureTabletHook函数的典型用法代码示例。如果您正苦于以下问题:Golang ConfigureTabletHook函数的具体用法?Golang ConfigureTabletHook怎么用?Golang ConfigureTabletHook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ConfigureTabletHook函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: executeHook

func (ta *TabletActor) executeHook(actionNode *actionnode.ActionNode) (err error) {
	// FIXME(msolomon) shouldn't the reply get distilled into an error?
	h := actionNode.Args.(*hook.Hook)
	topotools.ConfigureTabletHook(h, ta.tabletAlias)
	actionNode.Reply = h.Execute()
	return nil
}
开发者ID:nettedfish,项目名称:vitess,代码行数:7,代码来源:actor.go

示例2: 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
}
开发者ID:erzel,项目名称:vitess,代码行数:19,代码来源:rpc_actions.go

示例3: changeTypeToRestore

// change a tablet type to RESTORE and set all the other arguments.
// from now on, we can go to:
// - back to IDLE if we don't use the tablet at all (after for instance
//   a successful ReserveForRestore but a failed Snapshot)
// - to SCRAP if something in the process on the target host fails
// - to SPARE if the clone works
func (ta *TabletActor) changeTypeToRestore(tablet, sourceTablet *topo.TabletInfo, parentAlias topo.TabletAlias, keyRange key.KeyRange) error {
	// run the optional preflight_assigned hook
	hk := hook.NewSimpleHook("preflight_assigned")
	topotools.ConfigureTabletHook(hk, ta.tabletAlias)
	if err := hk.ExecuteOptional(); err != nil {
		return err
	}

	// change the type
	tablet.Parent = parentAlias
	tablet.Keyspace = sourceTablet.Keyspace
	tablet.Shard = sourceTablet.Shard
	tablet.Type = topo.TYPE_RESTORE
	tablet.KeyRange = keyRange
	tablet.DbNameOverride = sourceTablet.DbNameOverride
	if err := topo.UpdateTablet(ta.ts, tablet); err != nil {
		return err
	}

	// and create the replication graph items
	return topo.CreateTabletReplicationData(ta.ts, tablet.Tablet)
}
开发者ID:nettedfish,项目名称:vitess,代码行数:28,代码来源:actor.go

示例4: 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()
}
开发者ID:littleyang,项目名称:vitess,代码行数:6,代码来源:agent_rpc_actions.go


注:本文中的github.com/youtube/vitess/go/vt/topotools.ConfigureTabletHook函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。