本文整理匯總了Golang中github.com/youtube/vitess/go/vt/wrangler.Wrangler.InitShardMaster方法的典型用法代碼示例。如果您正苦於以下問題:Golang Wrangler.InitShardMaster方法的具體用法?Golang Wrangler.InitShardMaster怎麽用?Golang Wrangler.InitShardMaster使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/vt/wrangler.Wrangler
的用法示例。
在下文中一共展示了Wrangler.InitShardMaster方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: commandInitShardMaster
func commandInitShardMaster(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
force := subFlags.Bool("force", false, "will force the reparent even if the provided tablet is not a master or the shard master")
waitSlaveTimeout := subFlags.Duration("wait_slave_timeout", 30*time.Second, "time to wait for slaves to catch up in reparenting")
if err := subFlags.Parse(args); err != nil {
return err
}
if subFlags.NArg() != 2 {
return fmt.Errorf("action InitShardMaster requires <keyspace/shard> <tablet alias>")
}
keyspace, shard, err := topoproto.ParseKeyspaceShard(subFlags.Arg(0))
if err != nil {
return err
}
tabletAlias, err := topoproto.ParseTabletAlias(subFlags.Arg(1))
if err != nil {
return err
}
return wr.InitShardMaster(ctx, keyspace, shard, tabletAlias, *force, *waitSlaveTimeout)
}