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

Method init

plugins/prefetch/fetch.cc:211–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211bool
212BgFetchState::init(const PrefetchConfig &config)
213{
214 int status = true;
215
216 /* Is throttling configured, 0 - don't throttle */
217 _concurrentFetchesMax = config.getFetchMax();
218
219 /* Initialize the state */
220 TSMutexLock(_lock);
221
222 /* Initialize 'simple' policy used to avoid concurrent fetches of the same object */
223 status &= initializePolicy(_unique, "simple");
224
225 /* Initialize the fetch metrics */
226 status &= initializeMetrics(_metrics, config);
227
228 /* Initialize the "pre-fetch" log */
229 status &= initializeLog(_log, config);
230
231 TSMutexUnlock(_lock);
232
233 /* Initialize fetching policy */
234 TSMutexLock(_policyLock);
235
236 if (!config.getFetchPolicy().empty() && 0 != config.getFetchPolicy().compare("simple")) {
237 status &= initializePolicy(_policy, config.getFetchPolicy().c_str());
238 if (nullptr != _policy) {
239 setMetric(FETCH_POLICY_MAXSIZE, _policy->getMaxSize());
240 }
241 } else {
242 PrefetchDebug("Policy not specified or 'simple' policy chosen (skipping)");
243 }
244
245 TSMutexUnlock(_policyLock);
246
247 return status;
248}
249
250bool
251BgFetchState::acquire(const String &url)

Callers 3

TSRemapNewInstanceFunction · 0.45
scheduleMethod · 0.45
getInstanceMethod · 0.45

Calls 15

TSMutexLockFunction · 0.85
initializePolicyFunction · 0.85
initializeMetricsFunction · 0.85
initializeLogFunction · 0.85
TSMutexUnlockFunction · 0.85
TSHttpHdrCreateFunction · 0.85
TSHttpHdrCopyFunction · 0.85
TSHttpTxnPristineUrlGetFunction · 0.85
TSUrlCloneFunction · 0.85
TSHandleMLocReleaseFunction · 0.85
TSUrlPathGetFunction · 0.85
TSUrlHttpQuerySetFunction · 0.85

Tested by

no test coverage detected