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

Method loadURLs

src/traffic_cache_tool/CacheTool.cc:554–587  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554Errata
555Cache::loadURLs(swoc::file::path const &path)
556{
557 static const swoc::TextView TAG_VOL("url");
558 ts::URLparser loadURLparser;
559 Errata zret;
560
561 std::error_code ec;
562 std::string load_content = swoc::file::load(path, ec);
563 if (ec.value() == 0) {
564 swoc::TextView content(load_content);
565 while (!content.empty()) {
566 swoc::TextView blob = content.take_prefix_at('\n');
567
568 swoc::TextView tag(blob.take_prefix_at('='));
569 if (tag.empty()) {
570 } else if (0 == strcasecmp(tag, TAG_VOL)) {
571 std::string url;
572 url.assign(blob.data(), blob.size());
573 int port_ptr = -1, port_len = -1;
574 int port = loadURLparser.getPort(url, port_ptr, port_len);
575 if (port_ptr >= 0 && port_len > 0) {
576 url.erase(port_ptr, port_len + 1); // get rid of :PORT
577 }
578 std::cout << "port # " << port << ":" << port_ptr << ":" << port_len << ":" << url << std::endl;
579 ts::CacheURL *curl = new ts::CacheURL(url, port);
580 URLset.emplace(curl);
581 }
582 }
583 } else {
584 zret = Errata(make_errno_code(EBADF), "Unable to load ", path.string());
585 }
586 return zret;
587}
588
589void
590Cache::dumpSpans(SpanDumpDepth depth)

Callers 2

Find_StripeFunction · 0.80
Get_ResponseFunction · 0.80

Calls 14

strcasecmpFunction · 0.85
ErrataClass · 0.85
make_errno_codeFunction · 0.85
take_prefix_atMethod · 0.80
emplaceMethod · 0.80
loadFunction · 0.50
valueMethod · 0.45
emptyMethod · 0.45
assignMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
getPortMethod · 0.45

Tested by

no test coverage detected