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/LoggingManager.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/LoggingManager.hpp')
| -rw-r--r-- | archive/2025/summer/bsc_karidas/include/LoggingManager.hpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/archive/2025/summer/bsc_karidas/include/LoggingManager.hpp b/archive/2025/summer/bsc_karidas/include/LoggingManager.hpp new file mode 100644 index 000000000..782c04d23 --- /dev/null +++ b/archive/2025/summer/bsc_karidas/include/LoggingManager.hpp @@ -0,0 +1,53 @@ +#ifndef LOGGING_SYSTEM_HPP +#define LOGGING_SYSTEM_HPP + +#include "Config.hpp" +#include "Logger.hpp" +#include "BufferQueue.hpp" +#include "SegmentedStorage.hpp" +#include "Writer.hpp" +#include "LogEntry.hpp" +#include <memory> +#include <vector> +#include <atomic> +#include <mutex> +#include <chrono> +#include <string> +#include <optional> + +class LoggingManager +{ +public: + explicit LoggingManager(const LoggingConfig &config); + ~LoggingManager(); + + bool start(); + bool stop(); + + BufferQueue::ProducerToken createProducerToken(); + bool append(LogEntry entry, + BufferQueue::ProducerToken &token, + const std::optional<std::string> &filename = std::nullopt); + bool appendBatch(std::vector<LogEntry> entries, + BufferQueue::ProducerToken &token, + const std::optional<std::string> &filename = std::nullopt); + + bool exportLogs(const std::string &outputPath, + std::chrono::system_clock::time_point fromTimestamp = std::chrono::system_clock::time_point(), + std::chrono::system_clock::time_point toTimestamp = std::chrono::system_clock::time_point()); + +private: + std::shared_ptr<BufferQueue> m_queue; // Thread-safe queue for queue items + std::shared_ptr<SegmentedStorage> m_storage; // Manages append-only log segments + std::vector<std::unique_ptr<Writer>> m_writers; // Multiple writer threads + std::atomic<bool> m_running{false}; // System running state + std::atomic<bool> m_acceptingEntries{false}; // Controls whether new entries are accepted + std::mutex m_systemMutex; // For system-wide operations + + size_t m_numWriterThreads; // Number of writer threads + size_t m_batchSize; // Batch size for writers + bool m_useEncryption; + int m_compressionLevel; +}; + +#endif \ No newline at end of file |