MCPcopy Create free account
hub / github.com/couchbase/cbft / obtainIndexesLimitForScope

Function obtainIndexesLimitForScope

limits.go:413–439  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

(mgr *cbgt.Manager, bucket, scope string)

Source from the content-addressed store, hash-verified

411// -----------------------------------------------------------------------------
412
413func obtainIndexesLimitForScope(mgr *cbgt.Manager, bucket, scope string) (int, error) {
414 if mgr == nil {
415 return 0, fmt.Errorf("manager is nil")
416 }
417
418 if len(bucket) == 0 || len(scope) == 0 {
419 return 0, fmt.Errorf("bucket/scope not available")
420 }
421
422 manifest, err := GetBucketManifest(bucket)
423 if err != nil {
424 return 0, err
425 }
426
427 for i := range manifest.Scopes {
428 if manifest.Scopes[i].Name == scope {
429 numIndexesLimit := 0
430 if limits, exists := manifest.Scopes[i].Limits["fts"]; exists {
431 numIndexesLimit = limits["num_fts_indexes"]
432 }
433
434 return numIndexesLimit, nil
435 }
436 }
437
438 return 0, fmt.Errorf("scope not found")
439}

Callers 1

limitIndexDefFunction · 0.85

Calls 1

GetBucketManifestFunction · 0.85

Tested by

no test coverage detected