// NewNotification creates a new notification object with some basic
// information.
342459
func NewNotification(summary, body string) Notification {
	return Notification{
		Summary: summary,
		Body:    body,
		Timeout: ExpiresDefault,
	}
}
237797
func (s *UpdatePipelineInput) SetNotifications(v *Notifications) *UpdatePipelineInput {
	s.Notifications = v
	return s
}
1110651
func queueNotification(req RequestPush) (int, []LogPushEntry) {
	var count int
	wg := sync.WaitGroup{}
	newNotification := []*PushNotification{}
	for i := range req.Notifications {
		notification := &req.Notifications[i]
		switch notification.Platform {
		case PlatFormIos:
			if !PushConf.Ios.Enabled {
				continue
			}
		case PlatFormAndroid:
			if !PushConf.Android.Enabled {
				continue
			}
		}
		newNotification = append(newNotification, notification)
	}

	log := make([]LogPushEntry, 0, count)
	for _, notification := range newNotification {
		if PushConf.Core.Sync {
			notification.wg = &wg
			notification.log = &log
			notification.AddWaitCount()
		}
		if !tryEnqueue(*notification, QueueNotification) {
			LogError.Error("max capacity reached")
		}
		count += len(notification.Tokens)
		// Count topic message
		if notification.To != "" {
			count++
		}
	}

	if PushConf.Core.Sync {
		wg.Wait()
	}

	StatStorage.AddTotalCount(int64(count))

	return count, log
}
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
}
353847
func (s *UpdateNotificationInput) SetNewNotification(v *Notification) *UpdateNotificationInput {
	s.NewNotification = v
	return s
}
157748
func (m *Machine) RegisterNotifier(services ...NotificationService) {
	for _, service := range services {
		m.notifiers = append(m.notifiers, service)
	}
}
449240
func New(chanDB *channeldb.DB) *ChannelNotifier {
	return &ChannelNotifier{
		ntfnServer: subscribe.NewServer(),
		chanDB:     chanDB,
	}
}
425795
func (s *AssessmentRun) SetNotifications(v []*AssessmentRunNotification) *AssessmentRun {
	s.Notifications = v
	return s
}
1199500
func NewNotifyRouter(g *GlobalContext) *NotifyRouter {
	return &NotifyRouter{
		Contextified: NewContextified(g),
		cm:           g.ConnectionManager,
		state:        make(map[ConnectionID]keybase1.NotificationChannels),
		listeners:    make(map[NotifyListenerID]NotifyListener),
	}
}
552825
func (a *API) CreateOrGetNotification(user int, notification *Notification) (*Notification, error) {
	dst := new(Notification)
	url := a.BuildURL("/v2/user/%d/notification", user)
	err := a.Post(url, Params{"upsert": "false"}, notification, dst)
	return dst, err
}
1140596
func newNotifyServiceHandler(config Config, log logger.Logger) keybase1.NotifyServiceInterface {
	s := &notifyServiceHandler{config: config, log: log}
	return s
}
231477
func NewNotifier(send func([]byte) (int, error)) Notifier {
	n := &notifier{}
	n.ctx, n.cancel = context.WithCancel(context.Background())
	n.send = send
	// n.maxlen = cap
	return n
}
664773
func (ref *Consumer) PrintNotification(note map[string][]int32) {
	for k, v := range note {
		fmt.Printf("  Topic: %s\n", k)
		fmt.Printf("    Partitions: %v\n", v)
	}
}
680561
func (s *Swarm) Notify(f inet.Notifiee) {
	s.notifs.Lock()
	s.notifs.m[f] = struct{}{}
	s.notifs.Unlock()
}
1162744
func NewNotificationService(context servicecontext.ServiceContext, config notification.Configuration) service.NotificationService {
	return &notificationServiceImpl{
		BaseService: base.NewBaseService(context),
		config:      config,
	}
}
1111567
func (s *UpdateSubscriberInput) SetNotification(v *Notification) *UpdateSubscriberInput {
	s.Notification = v
	return s
}
688497
func newWsNotificationManager(server *rpcServer) *wsNotificationManager {
	return &wsNotificationManager{
		server:            server,
		queueNotification: make(chan interface{}),
		notificationMsgs:  make(chan interface{}),
		numClients:        make(chan int),
		quit:              make(chan struct{}),
	}
}