MCPcopy Create free account
hub / github.com/apache/trafficserver / lookup

Method lookup

src/iocore/cache/Cache.cc:303–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303Action *
304Cache::lookup(Continuation *cont, const CacheKey *key, CacheFragType type, const char *hostname, int host_len) const
305{
306 if (!CacheProcessor::IsCacheReady(type)) {
307 cont->handleEvent(CACHE_EVENT_LOOKUP_FAILED, nullptr);
308 return ACTION_RESULT_DONE;
309 }
310
311 StripeSM *stripe = key_to_stripe(key, hostname, host_len);
312 CacheVC *c = new_CacheVC(cont);
313 SET_CONTINUATION_HANDLER(c, &CacheVC::openReadStartHead);
314 c->vio.op = VIO::READ;
315 c->op_type = static_cast<int>(CacheOpType::Lookup);
316 ts::Metrics::Gauge::increment(cache_rsb.status[c->op_type].active);
317 ts::Metrics::Gauge::increment(stripe->cache_vol->vol_rsb.status[c->op_type].active);
318 c->first_key = c->key = *key;
319 c->frag_type = type;
320 c->f.lookup = 1;
321 c->stripe = stripe;
322 c->last_collision = nullptr;
323
324 if (c->handleEvent(EVENT_INTERVAL, nullptr) == EVENT_CONT) {
325 return &c->_action;
326 } else {
327 return ACTION_RESULT_DONE;
328 }
329}
330
331Action *
332Cache::open_read(Continuation *cont, const CacheKey *key, CacheFragType type, const char *hostname, int host_len) const

Callers 1

Calls 3

new_CacheVCFunction · 0.85
incrementFunction · 0.85
handleEventMethod · 0.45

Tested by 1