Exemplo n.º 1
0
func (i *Import) CallAll(function string, parameter interface{}, s *eventual2go.StreamController) {
	i.logger.Println("CallAll", function)
	req := i.newRequest(function, parameter, messages.ONE2MANY)
	s.Join(i.results.Where(isRes(req.UUID)))
	i.Deliver(req)
	return
}
Exemplo n.º 2
0
func serviceGone(client *eventual2go.StreamController) eventual2go.Subscriber {
	return func(d eventual2go.Data) {
		s := d.(service.ServiceGone)
		if !client.Closed().Completed() {
			client.Add(NewServiceGone(s))
		}
	}
}
Exemplo n.º 3
0
func (a *Announcer) announce(eventual2go.Data) {
	a.logger.Println("announcing")
	var results *eventual2go.StreamController
	if a.servicetype == IMPORTING {
		results = eventual2go.NewStreamController()
		c := results.AsChan()
		go a.collectAnnounceResponses(c)
	} else {
		a.announced.Complete(nil)
	}
	a.node.Query(a.servicetype, a.node.UUID, results)
	return
}
Exemplo n.º 4
0
func waitForQueryFinish(s *eventual2go.StreamController, wg *sync.WaitGroup) {
	wg.Wait()
	s.Close()
}
Exemplo n.º 5
0
func collectResponse(iface string, resp *serf.QueryResponse, s *eventual2go.StreamController, wg *sync.WaitGroup) {
	for r := range resp.ResponseCh() {
		s.Add(QueryResponseEvent{iface, r})
	}
	wg.Done()
}
Exemplo n.º 6
0
func serviceGone(client *eventual2go.StreamController) eventual2go.Subscriber {
	return func(d eventual2go.Data) {
		uuid := d.(string)
		client.Add(NewServiceGone(uuid))
	}
}
Exemplo n.º 7
0
func serviceArrived(client *eventual2go.StreamController) eventual2go.Subscriber {
	return func(d eventual2go.Data) {
		sa := d.(service.ServiceArrived)
		client.Add(NewServiceArrived(sa))
	}
}
Exemplo n.º 8
0
func (i *Import) CallAll(function string, parameter []byte, s *eventual2go.StreamController) {
	i.logger.Println("CallAll", function)
	uuid := i.call(function, parameter, messages.ONE2MANY)
	s.Join(i.results.Where(isRes(uuid)))
	return
}