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

Method RemoveDatabase

rest/server_context.go:1650–1661  ·  view source on GitHub ↗

RemoveDatabase is called when an external request is made to delete the database

(ctx context.Context, dbName string, reason string)

Source from the content-addressed store, hash-verified

1648
1649// RemoveDatabase is called when an external request is made to delete the database
1650func (sc *ServerContext) RemoveDatabase(ctx context.Context, dbName string, reason string) bool {
1651 sc._databasesLock.Lock()
1652 defer sc._databasesLock.Unlock()
1653
1654 // If async init is running for the database, cancel it for an external remove. (cannot be
1655 // done in _removeDatabase, as this is called during reload)
1656 if sc.DatabaseInitManager != nil && sc.DatabaseInitManager.HasActiveInitialization(dbName) {
1657 sc.DatabaseInitManager.Cancel(dbName, reason)
1658 }
1659
1660 return sc._removeDatabase(ctx, dbName)
1661}
1662
1663// _unloadDatabase unloads and stops the database, but does not remove the in-memory config.
1664func (sc *ServerContext) _unloadDatabase(ctx context.Context, dbName string) bool {

Callers 5

TestAllDatabaseNamesFunction · 0.95
handleFlushMethod · 0.80
handleDeleteDBMethod · 0.80
TestNoDBInCheckpointHashFunction · 0.80

Calls 5

_removeDatabaseMethod · 0.95
CancelMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by 3

TestAllDatabaseNamesFunction · 0.76
TestNoDBInCheckpointHashFunction · 0.64