_removeDatabase unloads and removes all references to the given database.
(ctx context.Context, dbName string)
| 1674 | |
| 1675 | // _removeDatabase unloads and removes all references to the given database. |
| 1676 | func (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 | |
| 1695 | func (sc *ServerContext) _isDatabaseSuspended(dbName string) bool { |
| 1696 | if config, loaded := sc._dbConfigs[dbName]; loaded && config.isSuspended { |
no test coverage detected