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

Method shouldCreate

db/indexes.go:274–301  ·  view source on GitHub ↗

shouldCreate returns if given index should be created.

(options InitializeIndexOptions)

Source from the content-addressed store, hash-verified

272
273// shouldCreate returns if given index should be created.
274func (i *SGIndex) shouldCreate(options InitializeIndexOptions) bool {
275 if options.LegacySyncDocsIndex {
276 if i.creationMode == SeparatePrincipalIndexes {
277 return false
278 }
279 } else {
280 if i.creationMode == LegacySyncDocsIndex {
281 return false
282 }
283
284 }
285 if i.isXattrOnly() && !options.UseXattrs {
286 return false
287 }
288
289 if i.isMetadataOnly() && options.MetadataIndexes == IndexesWithoutMetadata {
290 return false
291 }
292
293 if !i.isMetadataOnly() && options.MetadataIndexes == IndexesMetadataOnly {
294 return false
295 }
296
297 if !i.isPrincipalOnly() && options.MetadataIndexes == IndexesPrincipalOnly {
298 return false
299 }
300 return true
301}
302
303// Creates index associated with specified SGIndex if not already present. Always defers build - a subsequent BUILD INDEX
304// will need to be invoked for any created indexes.

Callers 2

InitializeIndexesFunction · 0.80
GetIndexNamesFunction · 0.80

Calls 3

isXattrOnlyMethod · 0.95
isMetadataOnlyMethod · 0.95
isPrincipalOnlyMethod · 0.95

Tested by

no test coverage detected