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

Function chash_lookup

src/proxy/ParentConsistentHash.cc:116–135  ·  view source on GitHub ↗

Helper function to abstract calling ATSConsistentHash lookup_by_hashval() vs lookup().

Source from the content-addressed store, hash-verified

114
115// Helper function to abstract calling ATSConsistentHash lookup_by_hashval() vs lookup().
116static pRecord *
117chash_lookup(ATSConsistentHash *fhash, uint64_t path_hash, ATSConsistentHashIter *chashIter, bool *wrap_around,
118 ATSHash64Sip24 *hash, bool *chash_init, bool *mapWrapped)
119{
120 pRecord *prtmp;
121
122 if (*chash_init == false) {
123 prtmp = (pRecord *)fhash->lookup_by_hashval(path_hash, chashIter, wrap_around);
124 *chash_init = true;
125 } else {
126 prtmp = (pRecord *)fhash->lookup(nullptr, chashIter, wrap_around, hash);
127 }
128 // Do not set wrap_around to true until we try all the parents at least once.
129 bool wrapped = *wrap_around;
130 *wrap_around = (*mapWrapped && *wrap_around) ? true : false;
131 if (!*mapWrapped && wrapped) {
132 *mapWrapped = true;
133 }
134 return prtmp;
135}
136
137void
138ParentConsistentHash::selectParent(bool first_call, ParentResult *result, RequestData *rdata,

Callers 1

selectParentMethod · 0.85

Calls 2

lookup_by_hashvalMethod · 0.80
lookupMethod · 0.45

Tested by

no test coverage detected