本文整理匯總了Golang中github.com/youtube/vitess/go/vt/topo.TabletInfo.GetAddr方法的典型用法代碼示例。如果您正苦於以下問題:Golang TabletInfo.GetAddr方法的具體用法?Golang TabletInfo.GetAddr怎麽用?Golang TabletInfo.GetAddr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/vt/topo.TabletInfo
的用法示例。
在下文中一共展示了TabletInfo.GetAddr方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: rpcCallTablet
func (client *GoRpcTabletManagerConn) rpcCallTablet(tablet *topo.TabletInfo, name string, args, reply interface{}, waitTime time.Duration) error {
// create the RPC client, using waitTime as the connect
// timeout, and starting the overall timeout as well
timer := time.After(waitTime)
rpcClient, err := bsonrpc.DialHTTP("tcp", tablet.GetAddr(), waitTime, nil)
if err != nil {
return fmt.Errorf("RPC error for %v: %v", tablet.Alias, err.Error())
}
defer rpcClient.Close()
// do the call in the remaining time
call := rpcClient.Go("TabletManager."+name, args, reply, nil)
select {
case <-timer:
return fmt.Errorf("Timeout waiting for TabletManager.%v to %v", name, tablet.Alias)
case <-call.Done:
if call.Error != nil {
return fmt.Errorf("Remote error for %v: %v", tablet.Alias, call.Error.Error())
} else {
return nil
}
}
}