// NewEventHandler creates a new EventHandler.
333413
func NewEventHandler(projector Projector, repo eh.ReadWriteRepo) *EventHandler {
	return &EventHandler{
		projector: projector,
		repo:      repo,
	}
}
1286296
func (m *EventHandler) HandleEvent(ctx context.Context, event eh.Event) error {
	if m.Err != nil {
		return m.Err
	}
	m.Events = append(m.Events, event)
	m.Context = ctx
	m.Time = time.Now()
	m.Recv <- event
	return nil
}
493328
func (b *DiskBuilder) GetEventHandler(event DiskBuildEvents) *DiskBuildEventHandler {
	if handler, ok := b.buildEventHandlers[event]; ok {
		return &handler
	}
	return nil
}
748396
func NewHandler(fun func(eventtypes.Message) string) *Handler {
	return &Handler{
		keyFunc:  fun,
		handlers: make(map[string]func(eventtypes.Message)),
	}
}
759343
func NewEvent(category string, action string) *Event {
	h := &Event{
		category: category,
		action:   action,
	}
	return h
}
505532
func NewHandler(prefix string, handler Handler) http.Handler {
	mux := http.NewServeMux()
	Handle(mux, prefix, handler)
	return mux
}
1272777
func NewEventHandler() *EventHandler {
	h := EventHandler{
		inbox:      make(chan eh.Event, 1),
		register:   make(chan *EventListener),
		unregister: make(chan *EventListener),
	}
	go h.run()
	return &h
}
671260
func (b *serverBuilder) GetEventHandler(event ServerBuildEvents) *ServerBuildEventHandler {
	if handler, ok := b.buildEventHandlers[event]; ok {
		return &handler
	}
	return nil
}
1293039
func (b *Builder) NewEvent() *Event {
	e := &Event{
		WriteKey:   b.WriteKey,
		Dataset:    b.Dataset,
		SampleRate: b.SampleRate,
		APIHost:    b.APIHost,
		Timestamp:  time.Now(),
		client:     b.client,
	}
	e.data = make(map[string]interface{})

	b.lock.RLock()
	defer b.lock.RUnlock()
	for k, v := range b.data {
		e.data[k] = v
	}
	// create dynamic metrics
	b.dynFieldsLock.RLock()
	defer b.dynFieldsLock.RUnlock()
	for _, dynField := range b.dynFields {
		e.AddField(dynField.name, dynField.fn())
	}
	return e
}
384929
func (c *ServiceConfig) RegisterEventHandler(handler ServiceHandler) {
	c.eventHandlers = append(c.eventHandlers, handler)
}
61852
func NewHandler(cm ChainManager, timeWindow time.Duration, mutualTLS bool, metrics *Metrics) *Handler {
	return &Handler{
		ChainManager:     cm,
		TimeWindow:       timeWindow,
		BindingInspector: InspectorFunc(comm.NewBindingInspector(mutualTLS, ExtractChannelHeaderCertHash)),
		Metrics:          metrics,
	}
}
248308
func NewEventScope() app.EventScope {
	return app.EventScope(&EventScope{
		eventsCallbacks: make(map[int][]app.EventCallback),
	})
}
838284
func NewHandler(log zerolog.Logger) func(http.Handler) http.Handler {
	return func(next http.Handler) http.Handler {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			// Create a copy of the logger (including internal context slice)
			// to prevent data race when using UpdateContext.
			l := log.With().Logger()
			r = r.WithContext(l.WithContext(r.Context()))
			next.ServeHTTP(w, r)
		})
	}
}
1064011
func (b *DiskBuilder) SetEventHandler(event DiskBuildEvents, handler DiskBuildEventHandler) {
	b.buildEventHandlers[event] = handler
}
215024
func NewEventError(err error) *EventError {
	return &EventError{t: time.Now(), err: err}
}
781115
func NewHandler(driver Driver) *Handler {
	h := &Handler{driver, sdk.NewHandler(manifest)}
	h.initMux()
	return h
}
800784
func newEvents(c *CoreClient, namespace string) *events {
	return &events{
		client: c,
		ns:     namespace,
	}
}