| 70 | } |
| 71 | |
| 72 | void CppPluginManagerImpl::DoCall(lgraph_api::Transaction* txn, |
| 73 | const std::string& user, |
| 74 | AccessControlledDB* db_with_access_control, |
| 75 | const std::string name, const PluginInfoBase* pinfo, |
| 76 | const std::string& request, double timeout, bool in_process, |
| 77 | std::string& output) { |
| 78 | if (timeout > 0) { |
| 79 | // TODO: schedule a timer event to kill this task // NOLINT |
| 80 | } |
| 81 | |
| 82 | // TODO: support in_process // NOLINT |
| 83 | bool r = false; |
| 84 | DynamicLibinfo info; |
| 85 | OpenDynamicLib(pinfo, info); |
| 86 | if (info.func) { |
| 87 | PluginFunc* procedure = info.func; |
| 88 | lgraph_api::GraphDB db(db_with_access_control, pinfo->read_only); |
| 89 | r = procedure(db, request, output); |
| 90 | } else if (info.func_txn && txn != nullptr) { |
| 91 | PluginFuncInTxn * procedure = info.func_txn; |
| 92 | Result re; |
| 93 | r = procedure(*txn, request, re); |
| 94 | output = re.Dump(); |
| 95 | } |
| 96 | CloseDynamicLib(info); |
| 97 | |
| 98 | if (!r) THROW_CODE(InputError, "Plugin returned false. Output: {}.", output); |
| 99 | } |
| 100 | |
| 101 | void CppPluginManagerImpl::DoCallV2(lgraph_api::Transaction* txn, |
| 102 | const std::string& user, |