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

Method _fetchAndLoadDatabase

rest/config.go:1733–1745  ·  view source on GitHub ↗

_fetchAndLoadDatabase will attempt to find the given database name first in a matching bucket name, but then fall back to searching through configs in each bucket to try and find a config.

(nonContextStruct base.NonCancellableContext, dbName string, forceReload bool)

Source from the content-addressed store, hash-verified

1731// _fetchAndLoadDatabase will attempt to find the given database name first in a matching bucket name,
1732// but then fall back to searching through configs in each bucket to try and find a config.
1733func (sc *ServerContext) _fetchAndLoadDatabase(nonContextStruct base.NonCancellableContext, dbName string, forceReload bool) (found bool, err error) {
1734 found, dbConfig, err := sc._fetchDatabase(nonContextStruct.Ctx, dbName)
1735 if err != nil || !found {
1736 return false, err
1737 }
1738 if forceReload {
1739 // setting the config cas to 0 will force the reload of the config from the further down stack
1740 dbConfig.cfgCas = 0
1741 }
1742 sc._applyConfigs(nonContextStruct.Ctx, map[string]DatabaseConfig{dbName: *dbConfig}, false, false)
1743
1744 return true, nil
1745}
1746
1747// migrateV30Configs checks for configs stored in the 3.0 location, and migrates them to the db registry
1748func (sc *ServerContext) migrateV30Configs(ctx context.Context) error {

Callers 2

fetchAndLoadDatabaseMethod · 0.95
handleCreateDBMethod · 0.80

Calls 2

_fetchDatabaseMethod · 0.95
_applyConfigsMethod · 0.95

Tested by

no test coverage detected