From a795f8e1ece4209e587e237f5b084ec92df21a90 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 27 Aug 2025 20:49:18 +0100 Subject: Use a DB connection pool rather than a single connection --- src/ingestor.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/ingestor.hpp') diff --git a/src/ingestor.hpp b/src/ingestor.hpp index 040331f..ef3ba19 100644 --- a/src/ingestor.hpp +++ b/src/ingestor.hpp @@ -2,6 +2,7 @@ #include "logTypes.hpp" #include +#include #include #include #include @@ -11,10 +12,10 @@ namespace WebStat { class Ingestor { public: - Ingestor(std::string_view hostname, DB::ConnectionPtr dbconn); + Ingestor(std::string_view hostname, DB::ConnectionPoolPtr); virtual ~Ingestor() = default; - SPECIAL_MEMBERS_DEFAULT_MOVE_NO_COPY(Ingestor); + SPECIAL_MEMBERS_DELETE(Ingestor); using ScanResult = decltype(scn::scan void storeLogLine(const std::tuple &) const; + template void storeLogLine(DB::Connection *, const std::tuple &) const; protected: size_t linesRead = 0; @@ -35,12 +36,12 @@ namespace WebStat { private: static constexpr size_t MAX_NEW_ENTITIES = 6; - void storeEntities(std::span>) const; + void storeEntities(DB::Connection *, std::span>) const; using NewEntities = std::array, MAX_NEW_ENTITIES>; template NewEntities newEntities(const std::tuple &) const; mutable std::flat_set existingEntities; uint32_t hostnameId; - DB::ConnectionPtr dbconn; + DB::ConnectionPoolPtr dbpool; }; } -- cgit v1.2.3