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

Method completeIndexRequestLOCKED

limits.go:377–402  ·  view source on GitHub ↗
(req *http.Request)

Source from the content-addressed store, hash-verified

375}
376
377func (e *rateLimiter) completeIndexRequestLOCKED(req *http.Request) {
378 if req.Method != "PUT" {
379 // skip GET, DELETE
380 return
381 }
382
383 // This is invoked after an index introduction/update, so the index
384 // definition should be available in the system.
385 indexName := rest.IndexNameLookup(req)
386 if _, indexDefsByName, err := e.mgr.GetIndexDefs(false); err == nil {
387 if indexDef, exists := indexDefsByName[indexName]; exists {
388 scope, _, _ := GetScopeCollectionsFromIndexDef(indexDef)
389 key := getBucketScopeKey(indexDef.SourceName, scope)
390 entry, exists := e.indexCache[key]
391 if !exists {
392 e.indexCache[key] = map[string]struct{}{indexName: struct{}{}}
393 } else {
394 // adds or updates index entry
395 entry[indexName] = struct{}{}
396 }
397 }
398 // whether index creation was successful or not, the pending
399 // entry will need to be removed
400 delete(e.pendingIndexes, indexName)
401 }
402}
403
404// -----------------------------------------------------------------------------
405

Callers 1

completeRequestMethod · 0.95

Calls 3

getBucketScopeKeyFunction · 0.85
GetIndexDefsMethod · 0.65

Tested by

no test coverage detected