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

Method Match

src/iocore/cache/CacheHosting.cc:107–136  ·  view source on GitHub ↗

void CacheHostMatcher::Match(RequestData* rdata, Result* result) Searches our tree and updates argresult for each element matching arg hostname

Source from the content-addressed store, hash-verified

105// arg hostname
106//
107void
108CacheHostMatcher::Match(const char *rdata, int rlen, CacheHostResult *result) const
109{
110 void *opaque_ptr;
111 CacheHostRecord *data_ptr;
112 bool r;
113
114 // Check to see if there is any work to do before making
115 // the string copy
116 if (num_el <= 0) {
117 return;
118 }
119
120 if (rlen == 0) {
121 return;
122 }
123
124 std::string_view data{rdata, static_cast<size_t>(rlen)};
125 HostLookupState s;
126
127 r = host_lookup->MatchFirst(data, &s, &opaque_ptr);
128
129 while (r == true) {
130 ink_assert(opaque_ptr != nullptr);
131 data_ptr = static_cast<CacheHostRecord *>(opaque_ptr);
132 data_ptr->UpdateMatch(result);
133
134 r = host_lookup->MatchNext(&s, &opaque_ptr);
135 }
136}
137
138//
139// char* CacheHostMatcher::NewEntry(bool domain_record,

Callers 3

key_to_stripeMethod · 0.45
scanStripeMethod · 0.45
findServerMethod · 0.45

Calls 3

MatchFirstMethod · 0.80
MatchNextMethod · 0.80
UpdateMatchMethod · 0.45

Tested by

no test coverage detected