| 154 | } |
| 155 | |
| 156 | bool DataProcessorsRuntimeHost::onConfig( |
| 157 | void* ctx, PJ_string_view_t id, PJ_string_view_t* out_recipe_json, PJ_error_t* out_error) noexcept { |
| 158 | auto* self = static_cast<DataProcessorsRuntimeHost*>(ctx); |
| 159 | if (self == nullptr) { |
| 160 | return false; |
| 161 | } |
| 162 | try { |
| 163 | const std::string key = DataProcessorService::makeTransformKey(self->plugin_id_, sdk::toStringView(id)); |
| 164 | auto recipe_json = self->service_.transformRecipeJson(key); |
| 165 | if (!recipe_json.has_value()) { |
| 166 | sdk::fillError(out_error, kErrorRejected, kDomain, "unknown data processor id"); |
| 167 | return false; |
| 168 | } |
| 169 | self->config_storage_ = std::move(*recipe_json); |
| 170 | if (out_recipe_json != nullptr) { |
| 171 | *out_recipe_json = sdk::toAbiString(self->config_storage_); |
| 172 | } |
| 173 | return true; |
| 174 | } catch (const std::exception& e) { |
| 175 | sdk::fillError(out_error, kErrorInternal, kDomain, e.what()); |
| 176 | return false; |
| 177 | } catch (...) { |
| 178 | sdk::fillError(out_error, kErrorInternal, kDomain, "unknown error reading data processor config"); |
| 179 | return false; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | bool DataProcessorsRuntimeHost::onValidate( |
| 184 | void* ctx, PJ_string_view_t kind, PJ_string_view_t language, PJ_string_view_t script, PJ_string_view_t params_json, |
nothing calls this directly
no test coverage detected