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

Method Init

src/iocore/cache/CacheHosting.cc:422–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422int
423CacheHostRecord::Init(CacheType typ)
424{
425 int i, j;
426 extern Queue<CacheVol> cp_list;
427 extern int cp_list_len;
428
429 num_vols = 0;
430 type = typ;
431 cp = static_cast<CacheVol **>(ats_malloc(cp_list_len * sizeof(CacheVol *)));
432 memset(cp, 0, cp_list_len * sizeof(CacheVol *));
433 num_cachevols = 0;
434 CacheVol *cachep = cp_list.head;
435 for (; cachep; cachep = cachep->link.next) {
436 if (cachep->scheme == type) {
437 Dbg(dbg_ctl_cache_hosting, "Host Record: %p, Volume: %d, size: %" PRId64, this, cachep->vol_number, (int64_t)cachep->size);
438 cp[num_cachevols] = cachep;
439 num_cachevols++;
440 num_vols += cachep->num_vols;
441 }
442 }
443 if (!num_cachevols) {
444 Warning("error: No volumes found for Cache Type %d", type);
445 return -1;
446 }
447 stripes = static_cast<StripeSM **>(ats_malloc(num_vols * sizeof(StripeSM *)));
448 int counter = 0;
449 for (i = 0; i < num_cachevols; i++) {
450 CacheVol *cachep1 = cp[i];
451 for (j = 0; j < cachep1->num_vols; j++) {
452 stripes[counter++] = cachep1->stripes[j];
453 }
454 }
455 ink_assert(counter == num_vols);
456
457 build_vol_hash_table(this);
458 return 0;
459}
460
461int
462CacheHostRecord::Init(matcher_line *line_info, CacheType typ)

Callers 3

NewEntryMethod · 0.45
BuildTableFromStringMethod · 0.45
BuildTableMethod · 0.45

Calls 5

ats_mallocFunction · 0.85
memsetFunction · 0.85
build_vol_hash_tableFunction · 0.85
strcasecmpFunction · 0.85
ats_freeFunction · 0.85

Tested by

no test coverage detected