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

Method _removeDatabase

rest/server_context.go:1676–1693  ·  view source on GitHub ↗

_removeDatabase unloads and removes all references to the given database.

(ctx context.Context, dbName string)

Source from the content-addressed store, hash-verified

1674
1675// _removeDatabase unloads and removes all references to the given database.
1676func (sc *ServerContext) _removeDatabase(ctx context.Context, dbName string) bool {
1677 dbCtx := sc._databases[dbName]
1678 if dbCtx == nil {
1679 return false
1680 }
1681
1682 if ok := sc._unloadDatabase(ctx, dbName); !ok {
1683 return ok
1684 }
1685 delete(sc._dbConfigs, dbName)
1686 delete(sc._dbRegistry, dbName)
1687 for fqCollection, registryDbName := range sc._collectionRegistry {
1688 if dbName == registryDbName {
1689 delete(sc._collectionRegistry, fqCollection)
1690 }
1691 }
1692 return true
1693}
1694
1695func (sc *ServerContext) _isDatabaseSuspended(dbName string) bool {
1696 if config, loaded := sc._dbConfigs[dbName]; loaded && config.isSuspended {

Callers 5

RemoveDatabaseMethod · 0.95
fetchAndLoadConfigsMethod · 0.95
handleCreateDBMethod · 0.80

Calls 1

_unloadDatabaseMethod · 0.95

Tested by

no test coverage detected