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

Function TSRemapNewInstance

plugins/prefetch/plugin.cc:758–782  ·  view source on GitHub ↗

* @brief Plugin new instance entry point. * * Processes the configuration and initializes the plugin instance. * @param argc plugin arguments number * @param argv plugin arguments * @param instance new plugin instance pointer (initialized in this function) * @param errBuf error message buffer * @param errBufSize error message buffer size * @return TS_SUCCES if success or TS_ERROR if failur

Source from the content-addressed store, hash-verified

756 * @return TS_SUCCES if success or TS_ERROR if failure
757 */
758TSReturnCode
759TSRemapNewInstance(int argc, char *argv[], void **instance, char * /* errBuf ATS_UNUSED */, int /* errBufSize ATS_UNUSED */)
760{
761 bool failed = true;
762
763 PrefetchInstance *inst = new PrefetchInstance();
764 if (nullptr != inst) {
765 if (inst->_config.init(argc, argv)) {
766 inst->_state = BgFetchStates::get()->getStateByName(inst->_config.getNameSpace());
767 if (nullptr != inst->_state) {
768 failed = !inst->_state->init(inst->_config);
769 }
770 }
771 }
772
773 if (failed) {
774 PrefetchError("failed to initialize the plugin");
775 delete inst;
776 *instance = nullptr;
777 return TS_ERROR;
778 }
779
780 *instance = inst;
781 return TS_SUCCESS;
782}
783
784/**
785 * @brief Plugin instance deletion clean-up entry point.

Callers

nothing calls this directly

Calls 3

getStateByNameMethod · 0.80
getFunction · 0.50
initMethod · 0.45

Tested by

no test coverage detected