(req *http.Request)
| 375 | } |
| 376 | |
| 377 | func (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 |
no test coverage detected