// notify sends notifies to the configured remote servers. It will try up to three times
// before giving up on a specific remote. We will sequentially loop through "to"
// until they all have replied (or have 3 failed attempts).
343593
func notify(zone string, to []string) error {
	m := new(dns.Msg)
	m.SetNotify(zone)
	c := new(dns.Client)

	for _, t := range to {
		if t == "*" {
			continue
		}
		if err := notifyAddr(c, m, t); err != nil {
			log.Error(err.Error())
		} else {
			log.Infof("Sent notify for zone %q to %q", zone, t)
		}
	}
	return nil
}
35344
func (ui *StdIOUI) notify(serviceMethod string, args interface{}) error {
	ctx := context.Background()
	err := ui.client.Notify(ctx, serviceMethod, args)
	if err != nil {
		log.Info("Error", "exc", err.Error())
	}
	return err
}
1346494
func Notify(notifyChan chan status.ProcessStatus) POption {
	return func(p *POptions) {
		p.notifyChan = notifyChan
	}
}
475893
func Notify(appName string, title string, text string, iconPath string) {
	notification(appName, title, text, iconPath)
}
15033
func (n *NotifyGroup) Notify() {
	n.l.Lock()
	defer n.l.Unlock()
	for ch := range n.notify {
		select {
		case ch <- struct{}{}:
		default:
		}
	}
	n.notify = nil
}
808924
func (d *Driver) SendNotification(message string) string {
	d.Messages = append(d.Messages, message)
	return message
}
142922
func (c *Conn) notify(method string, data []byte) {
	c.streamMu.Lock()
	stream := c.streams[method]
	c.streamMu.Unlock()

	if stream != nil {
		// Stream writer must be able to handle incoming writes
		// even after it has been removed (unsubscribed).
		stream.write(method, data)
	}
}
326414
func (s Service) Notify(subject, body string) error {
	return s.NotifyWithHeaders(subject, body, nil)
}
160271
func (logNotifier *LogNotifier) Notify(alerts Messages) bool {

	logrus.Println("logging messages...")

	logDir := path.Dir(logNotifier.Path)
	err := os.MkdirAll(logDir, os.ModePerm)
	if err != nil {
		logrus.Error(fmt.Sprintf("unable to create directory for logfile: %v", err))
		return false
	}

	file, err := os.OpenFile(logNotifier.Path, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0666)
	if err != nil {
		logrus.Error(fmt.Sprintf("unable to write to logfile: %v", err))
		return false
	}

	logger := log.New(file, "[consul-notifier] ", log.LstdFlags)
	for _, alert := range alerts {
		logger.Printf("Node=%s, Service=%s, Check=%s, Status=%s\n", alert.Node, alert.Service, alert.Check, alert.Status)
	}
	logrus.Println("Notifications logged.")
	return true
}
941982
func (opsgenie *OpsGenieNotifier) Notify(messages Messages) bool {

	overallStatus, pass, warn, fail := messages.Summary()

	client := new(ogcli.OpsGenieClient)
	client.SetAPIKey(opsgenie.ApiKey)

	alertCli, cliErr := client.AlertV2()

	if cliErr != nil {
		log.Println("Opsgenie notification trouble with client")
		return false
	}

	ok := true
	for _, message := range messages {
		title := fmt.Sprintf("\n%s:%s:%s is %s.", message.Node, message.Service, message.Check, message.Status)
		alias := opsgenie.createAlias(message)
		content := fmt.Sprintf(header, opsgenie.ClusterName, overallStatus, fail, warn, pass)
		content += fmt.Sprintf("\n%s:%s:%s is %s.", message.Node, message.Service, message.Check, message.Status)
		content += fmt.Sprintf("\n%s", message.Output)

		// create the alert
		switch {
		case message.IsCritical():
			ok = opsgenie.createAlert(alertCli, title, content, alias) && ok
		case message.IsWarning():
			ok = opsgenie.createAlert(alertCli, title, content, alias) && ok
		case message.IsPassing():
			ok = opsgenie.closeAlert(alertCli, alias) && ok
		default:
			ok = false
			log.Warn("Message was not either IsCritical, IsWarning or IsPasssing. No notification was sent for ", alias)
		}
	}
	return ok
}
1083552
func (n *Notifier) Notify(id ID, data interface{}) error {
	enc, err := json.Marshal(data)
	if err != nil {
		return err
	}

	n.mu.Lock()
	defer n.mu.Unlock()

	if n.sub == nil {
		panic("can't Notify before subscription is created")
	} else if n.sub.ID != id {
		panic("Notify with wrong ID")
	}
	if n.activated {
		return n.send(n.sub, enc)
	}
	n.buffer = append(n.buffer, enc)
	return nil
}
582385
func (b *Broadcaster) Notify(instance interface{}) {
	b.listenerLock.RLock()
	listeners := b.listeners
	b.listenerLock.RUnlock()
	for _, listener := range listeners {
		listener.OnUpdate(instance)
	}
}
461457
func (e *EventSubscriber) Notify(event *ct.Event) {
	if len(e.objectTypes) > 0 {
		foundType := false
		for _, typ := range e.objectTypes {
			if typ == string(event.ObjectType) {
				foundType = true
				break
			}
		}
		if !foundType {
			return
		}
	}
	if e.objectID != "" && e.objectID != event.ObjectID {
		return
	}
	select {
	case e.queue <- event:
	default:
		// Run in a goroutine to avoid deadlock with Notify
		go e.CloseWithError(ErrEventBufferOverflow)
	}
}
871925
func RetryNotify(operation Operation, b BackOff, notify Notify) error {
	var err error
	var next time.Duration
	var t *time.Timer

	cb := ensureContext(b)

	b.Reset()
	for {
		if err = operation(); err == nil {
			return nil
		}

		if permanent, ok := err.(*PermanentError); ok {
			return permanent.Err
		}

		if next = cb.NextBackOff(); next == Stop {
			return err
		}

		if notify != nil {
			notify(err, next)
		}

		if t == nil {
			t = time.NewTimer(next)
			defer t.Stop()
		} else {
			t.Reset(next)
		}

		select {
		case <-cb.Context().Done():
			return err
		case <-t.C:
		}
	}
}
145568
func Notify(ctx context.Context, subj, msg string) error {
	if os.Getenv("GOPASS_NO_NOTIFY") != "" || !ctxutil.IsNotifications(ctx) {
		return nil
	}
	conn, err := dbus.SessionBus()
	if err != nil {
		return err
	}

	obj := conn.Object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
	call := obj.Call("org.freedesktop.Notifications.Notify", 0, "gopass", uint32(0), iconURI(), subj, msg, []string{}, map[string]dbus.Variant{}, int32(5000))
	if call.Err != nil {
		return err
	}

	return nil
}
1185813
func (r *Repo) Notify(ctx context.Context, event eh.Event) {
	// Bust the cache on entity updates.
	ns := r.namespace(ctx)
	r.cacheMu.Lock()
	delete(r.cache[ns], event.AggregateID())
	r.cacheMu.Unlock()
}
885081
func (es *EventStream) Notify(event string, bytes []byte) {
	// TODO reader?

	lines := strings.Split(string(bytes), "\n")

	data := ""
	for _, l := range lines {
		data += event + ": " + l + "\n"
	}

	sz := len(data) + 1
	size := fmt.Sprintf("%X", sz)

	for _, er := range es.receivers {
		go er.send(size, data)
	}
}