// Run ... func Run(manager *manager.Manager, port uint) { path := filepath.Join(config.GetConfig().DataDir, "skizze.aof") storage := storage.NewAOF(path) lis, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) // RPC port if err != nil { log.Fatalf("failed to listen: %v", err) } g := grpc.NewServer() server = &serverStruct{manager, g, storage} pb.RegisterSkizzeServer(g, server) server.replay() _ = g.Serve(lis) }
// Run ... func Run(manager *manager.Manager, host string, port int, datadir string) { nCPU := runtime.NumCPU() runtime.GOMAXPROCS(nCPU) path := filepath.Join(datadir, "skizze.aof") aof := storage.NewAOF(path) lis, err := net.Listen("tcp", fmt.Sprintf("%s:%d", host, port)) // RPC port if err != nil { logger.Criticalf("failed to listen: %v", err) } g := grpc.NewServer() server = &serverStruct{manager, g, aof} pb.RegisterSkizzeServer(g, server) server.replay() aof.Run() _ = g.Serve(lis) }