diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-25 13:06:07 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-25 16:02:48 +0100 |
commit | 21a9cb6866afe3354bee60d852ebffc7ef3a8355 (patch) | |
tree | f897bdf6bf63971e24adeb2c7850252ce38fc345 /src/ingestor.hpp | |
parent | 7301fe6484dc1b1d652425ad005ccfd214002a87 (diff) | |
download | webstat-21a9cb6866afe3354bee60d852ebffc7ef3a8355.tar.bz2 webstat-21a9cb6866afe3354bee60d852ebffc7ef3a8355.tar.xz webstat-21a9cb6866afe3354bee60d852ebffc7ef3a8355.zip |
Insert new entities and log entry in a transaction
If no new entities are required, no transaction is created.
Diffstat (limited to 'src/ingestor.hpp')
-rw-r--r-- | src/ingestor.hpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ingestor.hpp b/src/ingestor.hpp index 7141515..040331f 100644 --- a/src/ingestor.hpp +++ b/src/ingestor.hpp @@ -6,6 +6,7 @@ #include <cstdio> #include <flat_set> #include <scn/scan.h> +#include <span> namespace WebStat { class Ingestor { @@ -33,7 +34,10 @@ namespace WebStat { size_t linesDiscarded = 0; private: - template<typename... T> size_t storeEntities(const std::tuple<T...> &) const; + static constexpr size_t MAX_NEW_ENTITIES = 6; + void storeEntities(std::span<const std::optional<Entity>>) const; + using NewEntities = std::array<std::optional<Entity>, MAX_NEW_ENTITIES>; + template<typename... T> NewEntities newEntities(const std::tuple<T...> &) const; mutable std::flat_set<Crc32Value> existingEntities; uint32_t hostnameId; |