buildCollectionIndexData determines the set of indexes required for each collection in the config, including the metadata collection
(config *DatabaseConfig)
| 184 | // buildCollectionIndexData determines the set of indexes required for each collection in the config, including |
| 185 | // the metadata collection |
| 186 | func buildCollectionIndexData(config *DatabaseConfig) CollectionInitData { |
| 187 | if len(config.Scopes) == 0 { |
| 188 | return CollectionInitData{base.DefaultScopeAndCollectionName(): db.IndexesAll} |
| 189 | } |
| 190 | |
| 191 | defaultScopeAndCollectionMetadataIndexes := db.IndexesMetadataOnly |
| 192 | |
| 193 | collectionInitData := make(CollectionInitData) |
| 194 | for scopeName, scopeConfig := range config.Scopes { |
| 195 | for collectionName := range scopeConfig.Collections { |
| 196 | scName := base.ScopeAndCollectionName{Scope: scopeName, Collection: collectionName} |
| 197 | if scName.IsDefault() { |
| 198 | defaultScopeAndCollectionMetadataIndexes = db.IndexesAll |
| 199 | continue |
| 200 | } |
| 201 | collectionInitData[scName] = db.IndexesWithoutMetadata |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | collectionInitData[base.DefaultScopeAndCollectionName()] = defaultScopeAndCollectionMetadataIndexes |
| 206 | |
| 207 | return collectionInitData |
| 208 | } |
| 209 | |
| 210 | // DatabaseInitWorker performs async database initialization tasks that should be performed in the background, |
| 211 | // independent of the database being reloaded for config changes |