MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / RegisterEventHandler

Method RegisterEventHandler

db/event_manager.go:130–134  ·  view source on GitHub ↗

Register a new event handler to the EventManager. The event manager will route events of type eventType to the handler.

(ctx context.Context, handler EventHandler, eventType EventType)

Source from the content-addressed store, hash-verified

128// Register a new event handler to the EventManager. The event manager will route events of
129// type eventType to the handler.
130func (em *EventManager) RegisterEventHandler(ctx context.Context, handler EventHandler, eventType EventType) {
131 em.eventHandlers[eventType] = append(em.eventHandlers[eventType], handler)
132 em.activeEventTypes[eventType] = true
133 base.InfofCtx(ctx, base.KeyEvents, "Registered event handler: %v, for event type %v", handler, eventType)
134}
135
136// Checks whether a handler of the given type has been registered to the event manager.
137func (em *EventManager) HasHandlerForEvent(eventType EventType) bool {

Callers 11

TestDocumentChangeEventFunction · 0.95
TestDBStateChangeEventFunction · 0.95
TestCustomHandlerFunction · 0.95
TestUnhandledEventFunction · 0.95
TestWebhookBasicFunction · 0.95
TestWebhookOverflowsFunction · 0.95
TestWebhookOldDocFunction · 0.95
TestWebhookTimeoutFunction · 0.95
TestUnavailableWebhookFunction · 0.95

Calls 1

InfofCtxFunction · 0.92

Tested by 10

TestDocumentChangeEventFunction · 0.76
TestDBStateChangeEventFunction · 0.76
TestCustomHandlerFunction · 0.76
TestUnhandledEventFunction · 0.76
TestWebhookBasicFunction · 0.76
TestWebhookOverflowsFunction · 0.76
TestWebhookOldDocFunction · 0.76
TestWebhookTimeoutFunction · 0.76
TestUnavailableWebhookFunction · 0.76