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

Method _suspendDatabase

rest/server_context.go:1702–1722  ·  view source on GitHub ↗
(ctx context.Context, dbName string)

Source from the content-addressed store, hash-verified

1700}
1701
1702func (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
1724func (sc *ServerContext) unsuspendDatabase(ctx context.Context, dbName string) (*db.DatabaseContext, error) {
1725 sc._databasesLock.Lock()

Callers 1

suspendDatabaseMethod · 0.95

Calls 6

_unloadDatabaseMethod · 0.95
ValDefaultFunction · 0.92
InfofCtxFunction · 0.92
MDFunction · 0.92
IsServerlessMethod · 0.80
GetNameMethod · 0.65

Tested by

no test coverage detected