diff options
| author | Dimitris <dimstav23@gmail.com> | 2025-07-15 15:11:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-15 15:11:36 +0200 |
| commit | 73e505f04d17eba36c41fce7b48bc4d6884b8fd0 (patch) | |
| tree | 44b5f4627309a48d6f22b54bb2ad9a2976e8601b /archive/2025/summer/bsc_karidas/include/Writer.hpp | |
| parent | ca92e7ad181a02890496872012ecc6c1d08b1658 (diff) | |
| parent | d8c365681a41961ebe2daea5701a4d56f5400d1d (diff) | |
| download | research-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.hpp | 40 |
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 |