RemoveDatabase is called when an external request is made to delete the database
(ctx context.Context, dbName string, reason string)
| 1648 | |
| 1649 | // RemoveDatabase is called when an external request is made to delete the database |
| 1650 | func (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. |
| 1664 | func (sc *ServerContext) _unloadDatabase(ctx context.Context, dbName string) bool { |