예제 #1
0
파일: server_test.go 프로젝트: silky/skizze
func setupClient() (pb.SkizzeClient, *grpc.ClientConn) {
	m := manager.NewManager()
	go Run(m, 7777)
	time.Sleep(time.Millisecond * 50)

	// Connect to the server.
	conn, err := grpc.Dial("127.0.0.1:7777", grpc.WithInsecure())
	if err != nil {
		log.Fatalf("fail to dial: %v", err)
	}
	return pb.NewSkizzeClient(conn), conn
}
예제 #2
0
func setupClient() (pb.SkizzeClient, *grpc.ClientConn) {
	testutils.SetupTests()
	m := manager.NewManager()
	datadir := config.DataDir
	go Run(m, "127.0.0.1", 7777, datadir)
	time.Sleep(time.Millisecond * 50)

	// Connect to the server.
	conn, err := grpc.Dial("127.0.0.1:7777", grpc.WithInsecure())
	if err != nil {
		logger.Criticalf("fail to dial: %v", err)
	}
	return pb.NewSkizzeClient(conn), conn
}
예제 #3
0
파일: main.go 프로젝트: seiflotfy/skizze
func main() {
	app := cli.NewApp()
	app.Name = "Skizze"
	app.Usage = "A sketch data store for counting and sketching using probabilistic data-structures"
	app.Version = version

	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:        "datadir, d",
			Value:       config.DataDir,
			Usage:       "the data directory",
			Destination: &datadir,
			EnvVar:      "SKIZZE_DATA_DIR",
		},
		cli.StringFlag{
			Name:        "host",
			Value:       config.Host,
			Usage:       "the host interface to bind to",
			Destination: &host,
			EnvVar:      "SKIZZE_HOST",
		},
		cli.IntFlag{
			Name:        "port, p",
			Value:       config.Port,
			Usage:       "the port to bind to",
			Destination: &port,
			EnvVar:      "SKIZZE_PORT",
		},
	}

	app.Action = func(*cli.Context) {
		datadir = setupDirectories(datadir)

		logger.Infof("Starting Skizze...")
		logger.Infof("Listening on: %s:%d", host, port)
		logger.Infof("Using data dir: %s", datadir)

		mngr := manager.NewManager()
		server.Run(mngr, host, port, datadir)
	}

	if err := app.Run(os.Args); err != nil {
		logger.Criticalf(err.Error())
	}
}
예제 #4
0
파일: main.go 프로젝트: silky/skizze
func main() {
	var port uint
	flag.UintVar(&port, "p", 3596, "specifies the port for Skizze to run on")
	flag.Parse()

	//TODO: Add arguments for dataDir and infoDir

	err := os.Setenv("SKIZZE_PORT", strconv.Itoa(int(port)))
	utils.PanicOnError(err)

	logger.Infof("Starting Skizze...")
	logger.Infof("Using data dir: %s", config.GetConfig().DataDir)
	//server, err := server.New()
	//utils.PanicOnError(err)
	//server.Run()
	mngr := manager.NewManager()
	if p, err := strconv.Atoi(os.Getenv("SKIZZE_PORT")); err == nil {
		server.Run(mngr, uint(p))
	}
}