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

Method RaiseDBStateChangeEvent

db/event_manager.go:182–205  ·  view source on GitHub ↗

Raises a DB state change event based on the db name, admininterface, new state, reason and local system time. If the event manager doesn't have a listener for this event, ignores.

(ctx context.Context, dbName string, state string, reason string, adminInterface *string)

Source from the content-addressed store, hash-verified

180// Raises a DB state change event based on the db name, admininterface, new state, reason and local system time.
181// If the event manager doesn't have a listener for this event, ignores.
182func (em *EventManager) RaiseDBStateChangeEvent(ctx context.Context, dbName string, state string, reason string, adminInterface *string) error {
183
184 if !em.activeEventTypes[DBStateChange] {
185 return nil
186 }
187
188 adminInterfaceStr := ""
189 if adminInterface != nil {
190 adminInterfaceStr = *adminInterface
191 }
192
193 body := make(Body, 5)
194 body["dbname"] = dbName
195 body["admininterface"] = adminInterfaceStr
196 body["state"] = state
197 body["reason"] = reason
198 body["localtime"] = time.Now().Format(base.ISO8601Format)
199
200 event := &DBStateChangeEvent{
201 Doc: body,
202 }
203
204 return em.raiseEvent(ctx, event)
205}

Callers 5

TestDBStateChangeEventFunction · 0.95
CloseMethod · 0.80
asyncDatabaseOnlineMethod · 0.80
TakeDbOfflineMethod · 0.80

Calls 1

raiseEventMethod · 0.95

Tested by 1

TestDBStateChangeEventFunction · 0.76