Exemplo n.º 1
0
func Boot() {
	pool = initPool()
	pool.boot()
	// Start router
	cli := router.NewRouterCli(router.SYS_ID, router.DefaultBuildClient)
	cli.Subscribe(router.SYS_ID)
	// Biding emitter
	distributer := &Distributer{cli, make(map[string]time.Time), make(map[int]uint64)}
	pool.emitter = distributer
	// Start receive from router
	go func() {
		for {
			if msg, err := distributer.PullRequest(); err == nil {
				pool.Signal <- msg
			}
		}
	}()
	logging.Info("Alfred: Startup.")
}
Exemplo n.º 2
0
// Initialize a new watchman
func NewWatchman() (*Watchman, error) {
	c := router.NewRouterCli(strconv.Itoa(time.Now().Nanosecond()), router.DefaultBuildClient)
	return &Watchman{make(map[string]uint32), c}, nil
}