90 std::vector<std::pair<int, db::LogEvent::EventItems>>&& eventBatch) = 0;
125 virtual void ParseData(
const std::filesystem::path& filepath) = 0;
161 virtual std::vector<std::pair<std::string, std::string>>
GetFileMetadata()
const {
return {}; }
188 if (!observer)
continue;
192 observer->NewEventFound(std::move(copy));
196 observer->NewEventFound(std::move(event));
204 if (observer) observer->ProgressUpdated();
208 std::vector<std::pair<int, db::LogEvent::EventItems>>&& eventBatch)
212 for (
size_t i = 0; i <
observers.size() - 1; ++i)
216 auto copy = eventBatch;
217 observers[i]->NewEventBatchFound(std::move(copy));
221 observers.back()->NewEventBatchFound(std::move(eventBatch));
Defines the LogEvent class for representing structured log entries.
Represents a single, structured log event with key-value data.
Definition LogEvent.hpp:97
std::vector< std::pair< std::string, std::string > > EventItems
A collection of key-value pairs representing event data (eventFieldName, data).
Definition LogEvent.hpp:101
Observer interface for receiving notifications from data parsers.
Definition IDataParser.hpp:52
virtual ~IDataParserObserver()=default
Virtual destructor for proper cleanup of derived classes.
virtual void NewEventBatchFound(std::vector< std::pair< int, db::LogEvent::EventItems > > &&eventBatch)=0
Called when a batch of new events is discovered during parsing.
virtual void NewEventFound(db::LogEvent &&event)=0
Called when a new event is discovered during parsing.
virtual void ProgressUpdated()=0
Called when parsing progress is updated.
Abstract base class for all data parsing implementations.
Definition IDataParser.hpp:110
virtual void ParseData(const std::filesystem::path &filepath)=0
Parses data from a file path.
virtual uint32_t GetTotalProgress() const =0
Gets the total expected progress value.
void NotifyProgressUpdated()
Definition IDataParser.hpp:201
virtual uint32_t GetCurrentProgress() const =0
Gets the current parsing progress.
void NotifyNewEvent(db::LogEvent &&event)
Definition IDataParser.hpp:184
std::vector< IDataParserObserver * > observers
Definition IDataParser.hpp:225
virtual ~IDataParser()=default
Virtual destructor for proper cleanup of derived classes.
virtual std::vector< std::pair< std::string, std::string > > GetFileMetadata() const
Ordered key → value pairs read from the file header during the last ParseData() call (see db::EventsC...
Definition IDataParser.hpp:161
void RegisterObserver(IDataParserObserver *observer)
Registers an observer to receive parsing notifications.
Definition IDataParser.hpp:171
void UnregisterObserver(IDataParserObserver *observer)
Definition IDataParser.hpp:177
void NotifyNewEventBatch(std::vector< std::pair< int, db::LogEvent::EventItems > > &&eventBatch)
Definition IDataParser.hpp:207
virtual void ParseData(std::istream &input)=0
Parses data from an input stream.
Data parsing components and interfaces.
Definition IControler.hpp:22