Use new name
This commit is contained in:
parent
463609a403
commit
583ac5da5b
|
@ -5,7 +5,7 @@ into the functions' first argument. Its main purpose is to hide common
|
||||||
unmarshalling code from each function implementation thus reducing
|
unmarshalling code from each function implementation thus reducing
|
||||||
boilerplate and making package interaction code sexier.
|
boilerplate and making package interaction code sexier.
|
||||||
|
|
||||||
[Documentation](https://godoc.org/github.com/localhots/uberdaemon/caller)
|
[Documentation](https://godoc.org/github.com/localhots/satan/caller)
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"github.com/localhots/uberdaemon/caller"
|
"github.com/localhots/satan/caller"
|
||||||
"github.com/path/to/package/messenger"
|
"github.com/path/to/package/messenger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ Support code:
|
||||||
package messenger
|
package messenger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/localhots/uberdaemon/caller"
|
"github.com/localhots/satan/caller"
|
||||||
)
|
)
|
||||||
|
|
||||||
type item struct {
|
type item struct {
|
||||||
|
|
|
@ -5,12 +5,12 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/localhots/uberdaemon"
|
"github.com/localhots/satan"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NumberPrinter is a daemon that prints numbers once in a while.
|
// NumberPrinter is a daemon that prints numbers once in a while.
|
||||||
type NumberPrinter struct {
|
type NumberPrinter struct {
|
||||||
uberdaemon.BaseDaemon
|
satan.BaseDaemon
|
||||||
}
|
}
|
||||||
|
|
||||||
// Startup sets up panic handler and starts enqueuing number printing jobs.
|
// Startup sets up panic handler and starts enqueuing number printing jobs.
|
||||||
|
@ -42,7 +42,7 @@ func (n *NumberPrinter) enqueue() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NumberPrinter) makeActor(num int) uberdaemon.Actor {
|
func (n *NumberPrinter) makeActor(num int) satan.Actor {
|
||||||
return func() {
|
return func() {
|
||||||
if rand.Intn(20) == 0 {
|
if rand.Intn(20) == 0 {
|
||||||
panic("Noooooooooo!")
|
panic("Noooooooooo!")
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
|
||||||
"github.com/localhots/uberdaemon"
|
"github.com/localhots/satan"
|
||||||
"github.com/localhots/uberdaemon/example/daemons"
|
"github.com/localhots/satan/example/daemons"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -19,10 +19,10 @@ func main() {
|
||||||
log.SetOutput(ioutil.Discard)
|
log.SetOutput(ioutil.Discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
uberd := uberdaemon.New()
|
s := satan.Summon()
|
||||||
uberd.AddDaemon(&daemons.NumberPrinter{})
|
s.AddDaemon(&daemons.NumberPrinter{})
|
||||||
uberd.Start()
|
s.Start()
|
||||||
defer uberd.Stop()
|
defer s.Stop()
|
||||||
|
|
||||||
sig := make(chan os.Signal)
|
sig := make(chan os.Signal)
|
||||||
signal.Notify(sig, os.Interrupt)
|
signal.Notify(sig, os.Interrupt)
|
||||||
|
|
Loading…
Reference in New Issue