// Events returns the set of events being waited on. It is the union of the
// masks of all registered entries.
541636
func (q *Queue) Events() EventMask {
	ret := EventMask(0)

	q.mu.RLock()
	for e := q.list.Front(); e != nil; e = e.Next() {
		ret |= e.mask
	}
	q.mu.RUnlock()

	return ret
}
186147
func (em *EventManager) HasEvent(m string) bool {
	var ok bool
	em.ro.RLock()
	_, ok = em.events[m]
	em.ro.RUnlock()
	return ok
}
432797
func (a *AdditionalSpanTags) AddEvents(ctx context.Context, events []*event.Event) error {
	return a.next.AddEvents(ctx, events)
}
313864
func (s *TopicConfiguration) SetEvents(v []*string) *TopicConfiguration {
	s.Events = v
	return s
}
645670
func (b *bufferedBackend) processEvents(events []*auditinternal.Event) {
	if len(events) == 0 {
		return
	}

	// TODO(audit): Should control the number of active goroutines
	// if one goroutine takes 5 seconds to finish, the number of goroutines can be 5 * defaultBatchThrottleQPS
	if b.throttle != nil {
		b.throttle.Accept()
	}

	if b.asyncDelegate {
		b.wg.Add(1)
		go func() {
			defer b.wg.Done()
			defer runtime.HandleCrash()

			// Execute the real processing in a goroutine to keep it from blocking.
			// This lets the batching routine continue draining the queue immediately.
			b.delegateBackend.ProcessEvents(events...)
		}()
	} else {
		func() {
			defer runtime.HandleCrash()

			// Execute the real processing in a goroutine to keep it from blocking.
			// This lets the batching routine continue draining the queue immediately.
			b.delegateBackend.ProcessEvents(events...)
		}()
	}
}
764600
func (c *containerAdapter) events(ctx context.Context) <-chan events.Message {
	log.G(ctx).Debugf("waiting on events")
	buffer, l := c.backend.SubscribeToEvents(time.Time{}, time.Time{}, c.container.eventFilter())
	eventsq := make(chan events.Message, len(buffer))

	for _, event := range buffer {
		eventsq <- event
	}

	go func() {
		defer c.backend.UnsubscribeFromEvents(l)

		for {
			select {
			case ev := <-l:
				jev, ok := ev.(events.Message)
				if !ok {
					log.G(ctx).Warnf("unexpected event message: %q", ev)
					continue
				}
				select {
				case eventsq <- jev:
				case <-ctx.Done():
					return
				}
			case <-ctx.Done():
				return
			}
		}
	}()

	return eventsq
}
1112654
func (factory *OpenweathermapBeeFactory) Events() []bees.EventDescriptor {
	events := []bees.EventDescriptor{
		{
			Namespace:   factory.Name(),
			Name:        "current_weather",
			Description: "Current weather holds measurement informations",
			Options: []bees.PlaceholderDescriptor{
				{
					Name:        "geo_pos_longitude",
					Type:        "float64",
					Description: "Geo position longitude",
				},
				{
					Name:        "geo_pos_latitude",
					Type:        "float64",
					Description: "Geo position latitude",
				},
				{
					Name:        "sys_type",
					Type:        "int",
					Description: "sys type",
				},
				{
					Name:        "sys_id",
					Type:        "int",
					Description: "sys ID",
				},
				{
					Name:        "sys_message",
					Type:        "float64",
					Description: "sys message",
				},
				{
					Name:        "sys_country",
					Type:        "string",
					Description: "sys country code",
				},
				{
					Name:        "sys_sunrise",
					Type:        "int",
					Description: "sys sunrise",
				},
				{
					Name:        "sys_sunset",
					Type:        "int",
					Description: "sys sunset",
				},
				{
					Name:        "base",
					Type:        "string",
					Description: "current weather base",
				},
				{
					Name:        "main_temp",
					Type:        "float64",
					Description: "current main temperature",
				},
				{
					Name:        "main_temp_min",
					Type:        "float64",
					Description: "current main minimum temperature",
				},
				{
					Name:        "main_temp_max",
					Type:        "float64",
					Description: "current main maximum temperature",
				},
				{
					Name:        "main_pressure",
					Type:        "float64",
					Description: "current air pressure",
				},
				{
					Name:        "main_sealevel",
					Type:        "float64",
					Description: "current sealevel",
				},
				{
					Name:        "main_grndlevel",
					Type:        "float64",
					Description: "current groundlevel",
				},
				{
					Name:        "main_humidity",
					Type:        "float64",
					Description: "main humidity",
				},
				{
					Name:        "wind_speed",
					Type:        "float64",
					Description: "wind speed",
				},
				{
					Name:        "wind_deg",
					Type:        "float64",
					Description: "wind degree",
				},
				{
					Name:        "clouds_all",
					Type:        "int",
					Description: "clouds",
				},
				{
					Name:        "rain",
					Type:        "map[string]float64",
					Description: "rain",
				},
				{
					Name:        "snow",
					Type:        "map[string]float64",
					Description: "snow",
				},
				{
					Name:        "dt",
					Type:        "int",
					Description: "dt",
				},
				{
					Name:        "id",
					Type:        "int",
					Description: "id",
				},
				{
					Name:        "name",
					Type:        "string",
					Description: "name",
				},
				{
					Name:        "cod",
					Type:        "int",
					Description: "cod",
				},
				{
					Name:        "unit",
					Type:        "string",
					Description: "unit meassurement system",
				},
				{
					Name:        "lang",
					Type:        "string",
					Description: "language",
				},
				{
					Name:        "key",
					Type:        "string",
					Description: "key",
				},
			},
		},
		{
			Namespace:   factory.Name(),
			Name:        "main_weather",
			Description: "returns main measurement weather informations",
			Options: []bees.PlaceholderDescriptor{
				{
					Name:        "id",
					Type:        "int",
					Description: "weather id",
				},
				{
					Name:        "main",
					Type:        "string",
					Description: "main weather information",
				},
				{
					Name:        "description",
					Type:        "string",
					Description: "current weather main description",
				},
				{
					Name:        "icon",
					Type:        "string",
					Description: "weather icon",
				},
			},
		},
	}
	return events
}
840479
func (s *VaultNotificationConfig) SetEvents(v []*string) *VaultNotificationConfig {
	s.Events = v
	return s
}
962663
func (a *EventCounter) Events(now time.Time, count int64) int64 {
	for {
		nsSince := now.Sub(a.startingTime).Nanoseconds()
		prevNsSinceStart := atomic.LoadInt64(&a.nsSinceStart)
		if nsSince-prevNsSinceStart >= a.eventDuration.Nanoseconds() {
			//		 Note: There is an accepted race here when we transition states that could cause us to
			//		       rarely miss an event that crosses the threshold.  This is an accepted aspect of
			//		       having a very fast non threshold event
			if atomic.CompareAndSwapInt64(&a.nsSinceStart, prevNsSinceStart, nsSince) {
				atomic.StoreInt64(&a.eventsThisPeriod, 0)
				break
			}
		} else {
			break
		}
	}
	return atomic.AddInt64(&a.eventsThisPeriod, count)
}
349396
func (filterHandler *FilterHandler) Event(logEvent *event.Event) error {
	for _, filterFunc := range filterHandler.filterFuncs {
		if !filterFunc(logEvent) {
			return nil
		}
	}
	return filterHandler.nextHandler.Event(logEvent)
}
1054824
func (s *AutoRollbackConfiguration) SetEvents(v []*string) *AutoRollbackConfiguration {
	s.Events = v
	return s
}
800784
func newEvents(c *CoreClient, namespace string) *events {
	return &events{
		client: c,
		ns:     namespace,
	}
}
1017227
func (mc MongoClient) getEvents(q bson.M) (me []models.Event, err error) {
	s := mc.getSessionCopy()
	defer s.Close()

	err = s.DB(mc.database.Name).C(db.EventsCollection).Find(q).All(&me)
	if err != nil {
		return []models.Event{}, errorMap(err)
	}
	return
}
287152
func (q *Queue) EventRegister(e *Entry, mask EventMask) {
	q.mu.Lock()
	e.mask = mask
	q.list.PushBack(e)
	q.mu.Unlock()
}
833679
func (s *eventLister) Events(namespace string) EventNamespaceLister {
	return eventNamespaceLister{indexer: s.indexer, namespace: namespace}
}
1010508
func (s *PutEventsInput) SetEvents(v []*Event) *PutEventsInput {
	s.Events = v
	return s
}
913870
func (s *LambdaFunctionConfiguration) SetEvents(v []*string) *LambdaFunctionConfiguration {
	s.Events = v
	return s
}