mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-08 03:47:51 +00:00
Move things around.
This commit is contained in:
parent
76bd3cc222
commit
9a18d91399
3 changed files with 20 additions and 41 deletions
|
|
@ -1,31 +1,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"pilosa/core"
|
||||
"pilosa/db"
|
||||
"flag"
|
||||
"log"
|
||||
"pilosa/cruncher"
|
||||
"pilosa/config"
|
||||
)
|
||||
|
||||
var tcpLoc string
|
||||
var httpLoc string
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&tcpLoc, "l", "127.0.0.1:1300", "ip:port to listen on (tcp)")
|
||||
flag.StringVar(&httpLoc, "h", "127.0.0.1:1400", "ip:port to listen on (http)")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
func main() {
|
||||
tcp, err := db.NewLocation(tcpLoc)
|
||||
if err != nil {
|
||||
log.Fatal("Location not valid:", tcpLoc)
|
||||
}
|
||||
http, err := db.NewLocation(httpLoc)
|
||||
if err != nil {
|
||||
log.Fatal("Location not valid:", httpLoc)
|
||||
}
|
||||
|
||||
service := core.NewService(tcp, http)
|
||||
service.Run()
|
||||
cruncher := cruncher.NewCruncher()
|
||||
cruncher.Run(config.GetInt("port_tcp"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import (
|
|||
"net"
|
||||
"encoding/gob"
|
||||
"pilosa/db"
|
||||
"pilosa/config"
|
||||
)
|
||||
|
||||
type Stats struct {
|
||||
|
|
@ -32,7 +31,6 @@ type Service struct {
|
|||
PortHttp string
|
||||
Etcd *etcd.Client
|
||||
Cluster *db.Cluster
|
||||
Cruncher *Cruncher
|
||||
TopologyMapper *TopologyMapper
|
||||
ProcessMapper *ProcessMapper
|
||||
ProcessMap *ProcessMap
|
||||
|
|
@ -40,9 +38,8 @@ type Service struct {
|
|||
Dispatcher *Dispatcher
|
||||
}
|
||||
|
||||
func NewService(tcp, http *db.Location) *Service {
|
||||
func NewService() *Service {
|
||||
service := new(Service)
|
||||
service.Cruncher = new(Cruncher)
|
||||
service.Etcd = etcd.NewClient(nil)
|
||||
service.Cluster = db.NewCluster()
|
||||
service.TopologyMapper = &TopologyMapper{service, "/pilosa/0"}
|
||||
|
|
@ -63,7 +60,6 @@ func (service *Service) GetSignals() (chan os.Signal, chan os.Signal) {
|
|||
func (service *Service) Run() {
|
||||
log.Println("Running service...")
|
||||
go service.TopologyMapper.Run()
|
||||
go service.Cruncher.Run(config.GetInt("port_tcp"))
|
||||
|
||||
sigterm, sighup := service.GetSignals()
|
||||
for {
|
||||
|
|
|
|||
|
|
@ -3,24 +3,27 @@ package cruncher
|
|||
import (
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"pilosa/index"
|
||||
"pilosa/core"
|
||||
)
|
||||
|
||||
|
||||
type Cruncher struct {
|
||||
core.Service
|
||||
close_chan chan bool
|
||||
}
|
||||
|
||||
func (cruncher *Cruncher) Run(port int) {
|
||||
spew.Dump("Cruncher.Run")
|
||||
spew.Dump(port)
|
||||
web_api:= index.NewFragmentContainer()
|
||||
// web_api.AddFragment("general", "25", 0, "AAA-BBB-CCC")
|
||||
// web_api.AddFragment("general", "25", 1, "AAA-BBB-CCC")
|
||||
// web_api.AddFragment("general", "25", 2, "AAA-BBB-CCC")
|
||||
|
||||
started:= make(chan bool)
|
||||
go web_api.RunServer(port , cruncher.close_chan ,started )
|
||||
<-started
|
||||
//server is listening and going
|
||||
|
||||
spew.Dump("Cruncher.Run")
|
||||
spew.Dump(port)
|
||||
web_api:= index.NewFragmentContainer()
|
||||
started:= make(chan bool)
|
||||
go web_api.RunServer(port , cruncher.close_chan ,started )
|
||||
cruncher.Service.Run()
|
||||
<-started
|
||||
}
|
||||
|
||||
func NewCruncher() *Cruncher {
|
||||
service := core.NewService()
|
||||
cruncher := Cruncher{*service, make(chan bool)}
|
||||
return &cruncher
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue