mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-10 15:01:03 +00:00
Add circuit basics.
This commit is contained in:
parent
5f496df0bc
commit
35afb346cb
3 changed files with 41 additions and 0 deletions
21
commands/pilosa-spawn/spawn.go
Normal file
21
commands/pilosa-spawn/spawn.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
_ "circuit/load/cmd"
|
||||
"circuit/use/circuit"
|
||||
"pilosa/cruncher"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.Println("Spawning...")
|
||||
|
||||
retrn, addr, err := circuit.Spawn("localhost", []string{"/cruncher"}, cruncher.App{})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Println(retrn, addr)
|
||||
|
||||
circuit.Hang()
|
||||
}
|
||||
|
||||
8
commands/pilosa-worker/worker.go
Normal file
8
commands/pilosa-worker/worker.go
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
_ "circuit/load/worker"
|
||||
_ "pilosa/cruncher"
|
||||
)
|
||||
|
||||
func main() {}
|
||||
|
|
@ -4,6 +4,8 @@ import (
|
|||
"pilosa/core"
|
||||
"pilosa/db"
|
||||
"log"
|
||||
"circuit/use/circuit"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Cruncher struct {
|
||||
|
|
@ -53,3 +55,13 @@ func (c *Cruncher) HandleInbox() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
type App struct{}
|
||||
func (App) Main() {
|
||||
log.Println("Starting cruncher!")
|
||||
time.Sleep(60*time.Second)
|
||||
}
|
||||
|
||||
func init() {
|
||||
circuit.RegisterFunc(App{})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue