(ctx context.Context, dbName string)
| 1700 | } |
| 1701 | |
| 1702 | func (sc *ServerContext) _suspendDatabase(ctx context.Context, dbName string) error { |
| 1703 | dbCtx := sc._databases[dbName] |
| 1704 | if dbCtx == nil { |
| 1705 | return base.ErrNotFound |
| 1706 | } |
| 1707 | |
| 1708 | config := sc._dbConfigs[dbName] |
| 1709 | if config != nil && !base.ValDefault(config.Suspendable, sc.Config.IsServerless()) { |
| 1710 | return ErrSuspendingDisallowed |
| 1711 | } |
| 1712 | |
| 1713 | bucket := dbCtx.Bucket.GetName() |
| 1714 | base.InfofCtx(ctx, base.KeyAll, "Suspending db %q (bucket %q)", base.MD(dbName), base.MD(bucket)) |
| 1715 | |
| 1716 | if !sc._unloadDatabase(ctx, dbName) { |
| 1717 | return base.ErrNotFound |
| 1718 | } |
| 1719 | |
| 1720 | config.isSuspended = true |
| 1721 | return nil |
| 1722 | } |
| 1723 | |
| 1724 | func (sc *ServerContext) unsuspendDatabase(ctx context.Context, dbName string) (*db.DatabaseContext, error) { |
| 1725 | sc._databasesLock.Lock() |
no test coverage detected