* @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
| 756 | * @return TS_SUCCES if success or TS_ERROR if failure |
| 757 | */ |
| 758 | TSReturnCode |
| 759 | TSRemapNewInstance(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. |
nothing calls this directly
no test coverage detected