// Returns if the event has any members which are not the event's blob payload,
// nor a header.
492464
func eventHasNonBlobPayloadMembers(s *Shape) bool {
	num := len(s.MemberRefs)
	for _, ref := range s.MemberRefs {
		if ref.IsEventHeader || (ref.IsEventPayload && (ref.Shape.Type == "blob" || ref.Shape.Type == "string")) {
			num--
		}
	}
	return num > 0
}
575101
func GetChaincodeEvents(eBytes []byte) (*peer.ChaincodeEvent, error) {
	chaincodeEvent := &peer.ChaincodeEvent{}
	err := proto.Unmarshal(eBytes, chaincodeEvent)
	return chaincodeEvent, errors.Wrap(err, "error unmarshaling ChaicnodeEvent")
}
376099
func IsDeleteEvent(event notify.Event) bool {
	for _, ev := range EventTypeDelete {
		if event&ev != 0 {
			return true
		}
	}
	return false
}
519379
func (s *Service) Events(ctx context.Context, evts chan events.ContainerEvent) error {
	filter := filters.NewArgs()
	filter.Add("label", fmt.Sprintf("%s=%s", labels.PROJECT, s.project.Name))
	filter.Add("label", fmt.Sprintf("%s=%s", labels.SERVICE, s.name))
	client := s.clientFactory.Create(s)
	eventq, errq := client.Events(ctx, types.EventsOptions{
		Filters: filter,
	})
	go func() {
		for {
			select {
			case event := <-eventq:
				service := event.Actor.Attributes[labels.SERVICE.Str()]
				attributes := map[string]string{}
				for _, attr := range eventAttributes {
					attributes[attr] = event.Actor.Attributes[attr]
				}
				e := events.ContainerEvent{
					Service:    service,
					Event:      event.Action,
					Type:       event.Type,
					ID:         event.Actor.ID,
					Time:       time.Unix(event.Time, 0),
					Attributes: attributes,
				}
				evts <- e
			}
		}
	}()
	return <-errq
}
690389
func IsPutEvent(event notify.Event) bool {
	for _, ev := range EventTypePut {
		if event&ev != 0 {
			return true
		}
	}
	return false
}
244966
func (c *Client) GetAPIEvents(i *GetAPIEventsFilterInput) (GetAPIEventsResponse, error) {
	eventsResponse := GetAPIEventsResponse{
		Events: []*Event{},
		Links:  EventsPaginationInfo{},
	}

	path := fmt.Sprintf("/events")

	filters := &RequestOptions{Params: i.formatEventFilters()}

	resp, err := c.Get(path, filters)

	if err != nil {
		return eventsResponse, err
	}

	err = c.interpretAPIEventsPage(&eventsResponse, i.PageNumber, resp)
	// NOTE: It's possible for eventsResponse to be partially completed before an error
	// was encountered, so the presence of a statusResponse doesn't preclude the presence of
	// an error.
	// }
	return eventsResponse, err
}
450087
func (e *FileEvent) IsDelete() bool {
	return ((e.mask&sys_FS_DELETE) == sys_FS_DELETE || (e.mask&sys_FS_DELETE_SELF) == sys_FS_DELETE_SELF)
}
1069342
func (b *serverBuilder) GetDiskEventHandler(event DiskBuildEvents) *DiskBuildEventHandler {
	return b.disk.GetEventHandler(event)
}
50006
func (em *EventManager) GetEvent(event string) (EventSubs, error) {
	if !em.HasEvent(event) {
		return nil, ErrEventNotFound
	}

	var ed EventSubs

	em.ro.RLock()
	ed = em.events[event]
	em.ro.RUnlock()

	return ed, nil
}
1248021
func ValidateEvent(eventCategory EventCategory, event Event) bool {
	valid := false
	switch eventCategory {
	case EventCategoryDefined:
		valid = int(event) >= 0 && event < EventDefinedLast
	case EventCategoryUndefined:
		valid = int(event) >= 0 && event < EventUndefinedLast
	case EventCategoryStarted:
		valid = int(event) >= 0 && event < EventStartedLast
	case EventCategorySuspended:
		valid = int(event) >= 0 && event < EventSuspendedLast
	case EventCategoryResumed:
		valid = int(event) >= 0 && event < EventResumedLast
	case EventCategoryStopped:
		valid = int(event) >= 0 && event < EventStoppedLast
	case EventCategoryShutdown:
		valid = int(event) >= 0 && event < EventShutdownLast
	case EventCategoryPmsuspended:
		valid = int(event) >= 0 && event < EventPMSuspendedLast
	}

	return valid
}
719508
func (self *FSock) readEvent() (header string, body string, err error) {
	var cl int

	if header, err = self.readHeaders(); err != nil {
		return "", "", err
	}
	if !strings.Contains(header, "Content-Length") { //No body
		return header, "", nil
	}
	if cl, err = strconv.Atoi(headerVal(header, "Content-Length")); err != nil {
		return "", "", errors.New("Cannot extract content length")
	}
	if body, err = self.readBody(cl); err != nil {
		return "", "", err
	}
	return
}
996952
func checkIfEventSatisfiesRequest(request *Request, event *Event) bool {
	startTime := request.StartTime
	endTime := request.EndTime
	eventTime := event.Timestamp
	if !startTime.IsZero() {
		if startTime.After(eventTime) {
			return false
		}
	}
	if !endTime.IsZero() {
		if endTime.Before(eventTime) {
			return false
		}
	}
	if !request.EventType[event.EventType] {
		return false
	}
	return true
}
470803
func (gw *Gateway) ignoreEvent(event string, dest *bridge.Bridge) bool {
	switch event {
	case config.EventAvatarDownload:
		// Avatar downloads are only relevant for telegram and mattermost for now
		if dest.Protocol != "mattermost" && dest.Protocol != "telegram" {
			return true
		}
	case config.EventJoinLeave:
		// only relay join/part when configured
		if !dest.GetBool("ShowJoinPart") {
			return true
		}
	case config.EventTopicChange:
		// only relay topic change when used in some way on other side
		if dest.GetBool("ShowTopicChange") && dest.GetBool("SyncTopic") {
			return true
		}
	}
	return false
}
1081659
func (c *CircularBuffer) Events() []Event {
	c.Lock()
	defer c.Unlock()
	return c.eventsCopy()
}
833679
func (s *eventLister) Events(namespace string) EventNamespaceLister {
	return eventNamespaceLister{indexer: s.indexer, namespace: namespace}
}
812231
func (ef *File) UnorderedEvents() (cgem chan *GoEvtxMap) {
	cgem = make(chan *GoEvtxMap, 42)
	go func() {
		defer close(cgem)
		chanQueue := make(chan (chan *GoEvtxMap), MaxJobs)
		go func() {
			defer close(chanQueue)
			for pc := range ef.UnorderedChunks() {
				// We have to create a copy here because otherwise cpc.EventsChan() fails
				// I guess that because EventsChan takes a pointer to an object and that
				// and thus the chan is taken on the pointer and since the object pointed
				// changes -> kaboom
				cpc, err := ef.FetchChunk(pc.Offset)
				switch {
				case err != nil && err != io.EOF:
					panic(err)
				case err == nil:
					ev := cpc.Events()
					chanQueue <- ev
				}
			}
		}()
		for ec := range chanQueue {
			for event := range ec {
				cgem <- event
			}
		}
	}()
	return
}
382841
func (f *ItemFlagger) HasEventFlag(ev *event.Event) bool {
	if f == nil {
		return false
	}
	setTo, exists := ev.Properties[f.EventMetaName]
	return exists && setTo == f
}