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

Method loadSpanDirect

src/traffic_cache_tool/CacheTool.cc:475–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

473}
474
475Errata
476Cache::loadSpanDirect(swoc::file::path const &path, int vol_idx, [[maybe_unused]] const Bytes &size)
477{
478 Errata zret;
479 std::unique_ptr<Span> span(new Span(path));
480 zret = span->load();
481 if (zret) {
482 if (span->_header) {
483 int nspb = span->_header->num_diskvol_blks;
484 for (auto i = 0; i < nspb; ++i) {
485 ts::CacheStripeDescriptor &raw = span->_header->stripes[i];
486 StripeSM *stripe = new StripeSM(span.get(), raw.offset, raw.len);
487 stripe->_idx = i;
488 if (raw.free == 0) {
489 stripe->_vol_idx = raw.vol_idx;
490 stripe->_type = raw.type;
491 _volumes[stripe->_vol_idx]._stripes.push_back(stripe);
492 _volumes[stripe->_vol_idx]._size += stripe->_len;
493 stripe->vol_init_data();
494 } else {
495 span->_free_space += stripe->_len;
496 }
497 span->_stripes.push_back(stripe);
498 globalVec_stripe.push_back(stripe);
499 }
500 span->_vol_idx = vol_idx;
501 } else {
502 span->clear();
503 }
504 _spans.push_back(span.release());
505 }
506 return zret;
507}
508
509Errata
510Cache::loadSpanConfig(swoc::file::path const &path)

Callers 1

loadSpanMethod · 0.95

Calls 6

vol_init_dataMethod · 0.80
loadMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected