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

Method Insert

src/proxy/http/remap/UrlMappingPathIndex.cc:41–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41bool
42UrlMappingPathIndex::Insert(url_mapping *mapping)
43{
44 int scheme_idx;
45 int port = (mapping->fromURL).port_get();
46 UrlMappingTrie *trie;
47 int from_path_len;
48 const char *from_path;
49
50 trie = _GetTrie(&(mapping->fromURL), scheme_idx, port);
51
52 if (!trie) {
53 trie = new UrlMappingTrie();
54 m_tries.insert(UrlMappingGroup::value_type(UrlMappingTrieKey(scheme_idx, port), trie));
55 Dbg(dbg_ctl_UrlMappingPathIndex_Insert, "Created new trie for scheme index, port combo <%d, %d>", scheme_idx, port);
56 }
57
58 from_path = mapping->fromURL.path_get(&from_path_len);
59 if (!trie->Insert(from_path, mapping, mapping->getRank(), from_path_len)) {
60 Error("Couldn't insert into trie!");
61 return false;
62 }
63 Dbg(dbg_ctl_UrlMappingPathIndex_Insert, "Inserted new element!");
64 return true;
65}
66
67url_mapping *
68UrlMappingPathIndex::Search(URL *request_url, int request_port, bool normal_search /* = true */) const

Callers 1

TableInsertMethod · 0.45

Calls 6

UrlMappingTrieKeyClass · 0.85
getRankMethod · 0.80
ErrorClass · 0.50
port_getMethod · 0.45
insertMethod · 0.45
path_getMethod · 0.45

Tested by

no test coverage detected