| 1614 | }; |
| 1615 | |
| 1616 | bool sourceObjectRegisterTopic( |
| 1617 | void* ctx, PJ_string_view_t topic_name, PJ_string_view_t metadata_json, PJ_object_topic_handle_t* out_handle, |
| 1618 | PJ_error_t* out_error) noexcept { |
| 1619 | auto* impl = static_cast<DatastoreSourceObjectWriteHostState*>(ctx); |
| 1620 | if (out_handle == nullptr) { |
| 1621 | propagateError(out_error, "out_handle must not be null"); |
| 1622 | return false; |
| 1623 | } |
| 1624 | auto* target = impl->target.load(std::memory_order_acquire); |
| 1625 | try { |
| 1626 | ObjectTopicDescriptor desc{}; |
| 1627 | desc.dataset_id = impl->dataset_id; |
| 1628 | desc.topic_name = std::string(toStringView(topic_name)); |
| 1629 | desc.metadata_json = std::string(toStringView(metadata_json)); |
| 1630 | auto result = target->registerTopic(desc); |
| 1631 | if (!result) { |
| 1632 | impl->setError(result.error()); |
| 1633 | propagateError(out_error, impl->last_error.c_str()); |
| 1634 | return false; |
| 1635 | } |
| 1636 | out_handle->id = result->id; |
| 1637 | impl->last_error.clear(); |
| 1638 | return true; |
| 1639 | } catch (const std::exception& e) { |
| 1640 | impl->setError(e.what()); |
| 1641 | propagateError(out_error, impl->last_error.c_str()); |
| 1642 | return false; |
| 1643 | } catch (...) { |
| 1644 | impl->setError("registerTopic: unknown exception"); |
| 1645 | propagateError(out_error, impl->last_error.c_str()); |
| 1646 | return false; |
| 1647 | } |
| 1648 | } |
| 1649 | |
| 1650 | bool sourceObjectPushOwned( |
| 1651 | void* ctx, PJ_object_topic_handle_t topic, int64_t timestamp_ns, const uint8_t* data, uint64_t size, |
nothing calls this directly
no test coverage detected