wrong import erros package

    GetClient
This commit is contained in:
snoop 2017-04-17 11:11:47 +09:00
parent e99727b62a
commit 3de26ac698

View File

@ -11,8 +11,9 @@ import (
"os" "os"
"log" "log"
"github.com/kataras/go-errors"
"path/filepath" "path/filepath"
"errors"
) )
const ( const (
@ -44,27 +45,25 @@ func init() {
//g_CrawlerMananger.init() //g_CrawlerMananger.init()
} }
func GetInstance() *CrawlerManager { func GetClient(container string) (*grpc.ClientConn, error) {
return g_CrawlerMananger; crm := GetInstance()
} b := crm.checkContainer(&container)
func (c *CrawlerManager)GetClient(container string,port string) (*grpc.ClientConn, error) {
b := c.checkContainer(&container)
if b == false { if b == false {
//c.runContainer(&container) err := crm.runAndInitContainer(&container)
//CallInit()
err := c.runAndInitContainer(&container)
if err != nil { if err != nil {
return nil, err return nil, err
} }
} }
gport := crm.portMap[container]
gport := c.portMap[container]
return grpc.Dial(address+gport, grpc.WithInsecure()) return grpc.Dial(address+gport, grpc.WithInsecure())
} }
func GetInstance() *CrawlerManager {
return g_CrawlerMananger;
}
func readConfig(path string ) *config.Config { func readConfig(path string ) *config.Config {