feat: C++20 rewrite of hookla#6
Open
Yomanz wants to merge 1 commit into
Open
Conversation
Direct port of the Scala/Finch/Akka/Quill/Circe service to modern C++. Shows what the same webhook aggregation logic looks like with: - Drogon v1.9 (HTTP server, C++20 coroutines) - libpqxx 7 (PostgreSQL, raw SQL replacing Quill ORM) - nlohmann/json (replacing Circe codec derivation) - cpp-httplib (replacing ackcord for Discord webhook calls) - Manual shared_ptr wiring in main.cpp (replacing MacWire) All three implemented providers are ported (GitHub 5 events, GitLab 6 events, Sonarr 4 events). Radarr and Ombi remain stubs, matching the Scala original.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cpp/Library mapping
co_awaitcoroutines)ConnectionPoolNLOHMANN_DEFINE_TYPE_NON_INTRUSIVE+ manual enum overloads)SSLClienttodiscord.com:443)shared_ptrwiring inmain.cppdebian:bookworm-slim(~30 MB, ~20 MB RSS idle)Key structural changes from Scala
Handler dispatch — both provider-level and event-level dispatch use
std::unordered_map<string, function<void(json, EventData)>>registered in each handler's constructor. Nostd::variant, no extra event class hierarchy. Adding a new event = one map entry.BaseEventclass hierarchy collapsed — the Scala version had this layer because MacWire needed classes to wire. In C++ the event handlers are private methods on the provider handler (or free functions for complex ones like GitLab push).JSON enums — each Scala
StringEnum(GithubRefType,GithubCheckRunAction,SonarrEventType, etc.) becomes a C++enum class+ a hand-writtenfrom_jsonfree function. ~100 lines that Circe/enumeratum generated automatically.Nullable columns — each
Option[T]in Scala models needs an explicitrow["col"].is_null()check inEmbedOptionsService.cppand friends.Test plan
cmake -B build && cmake --build buildcompiles cleanly with clang-17 or gcc-13docker build -f cpp/Dockerfile cpp/produces a working image/process/:tokenwith a GitHub push payload returns200 successand sends a Discord embed401200(graceful no-op)eventType: "Test"in body) sends the test embed