about summary refs log tree commit diff stats
path: root/archive/2025/summer/bsc_karidas/include/Writer.hpp
diff options
context:
space:
mode:
authorDimitris <dimstav23@gmail.com>2025-07-15 15:11:36 +0200
committerGitHub <noreply@github.com>2025-07-15 15:11:36 +0200
commit73e505f04d17eba36c41fce7b48bc4d6884b8fd0 (patch)
tree44b5f4627309a48d6f22b54bb2ad9a2976e8601b /archive/2025/summer/bsc_karidas/include/Writer.hpp
parentca92e7ad181a02890496872012ecc6c1d08b1658 (diff)
parentd8c365681a41961ebe2daea5701a4d56f5400d1d (diff)
downloadresearch-work-archive-artifacts-73e505f04d17eba36c41fce7b48bc4d6884b8fd0.tar.gz
research-work-archive-artifacts-73e505f04d17eba36c41fce7b48bc4d6884b8fd0.zip
Merge pull request #6 from chriskari/upload-artifacts
Add bsc_karidas
Diffstat (limited to 'archive/2025/summer/bsc_karidas/include/Writer.hpp')
-rw-r--r--archive/2025/summer/bsc_karidas/include/Writer.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/archive/2025/summer/bsc_karidas/include/Writer.hpp b/archive/2025/summer/bsc_karidas/include/Writer.hpp
new file mode 100644
index 000000000..3bc9e1672
--- /dev/null
+++ b/archive/2025/summer/bsc_karidas/include/Writer.hpp
@@ -0,0 +1,40 @@
+#ifndef WRITER_HPP
+#define WRITER_HPP
+
+#include <thread>
+#include <atomic>
+#include <memory>
+#include <vector>
+#include "QueueItem.hpp"
+#include "BufferQueue.hpp"
+#include "SegmentedStorage.hpp"
+
+class Writer
+{
+public:
+    explicit Writer(BufferQueue &queue,
+                    std::shared_ptr<SegmentedStorage> storage,
+                    size_t batchSize = 100,
+                    bool useEncryption = true,
+                    int m_compressionLevel = 9);
+
+    ~Writer();
+
+    void start();
+    void stop();
+    bool isRunning() const;
+
+private:
+    void processLogEntries();
+
+    BufferQueue &m_queue;
+    std::shared_ptr<SegmentedStorage> m_storage;
+    std::unique_ptr<std::thread> m_writerThread;
+    std::atomic<bool> m_running{false};
+    const size_t m_batchSize;
+    const bool m_useEncryption;
+    const int m_compressionLevel;
+
+    BufferQueue::ConsumerToken m_consumerToken;
+};
+#endif
\ No newline at end of file