Event Class
The Event class represents the smallest data unit in ChronoLog. Each Event contains a timestamp, client ID, an index, and a log record.
Constructor
Event::Event(chrono_time event_time = 0, ClientId client_id = 0, chrono_index index = 0, std::string const &record = std::string())
- Creates an Event object.
- event_time: The timestamp of the event.
- client_id: The client ID that generated the event.
- index: The event index for ordering.
- record: The actual data record of the event.
Getters
uint64_t Event::time() const
- Returns the timestamp of the Event.
ClientId const &Event::client_id() const
- Returns the client ID of the Event.
uint32_t Event::index() const
- Returns the index of the Event.
std::string const &Event::log_record() const
- Returns the log record of the Event.
Operators
bool Event::operator==(const Event &other) const
- Checks if two Events are equal based on event_time, client_id, and eventIndex.
bool Event::operator!=(const Event &other) const
- Checks if two Events are different.
bool Event::operator<(const Event &other) const
- Compares Events based on event_time, then client_id, and finally eventIndex.
std::string Event::toString() const
- Returns a string representation of the Event in the format:
{Event:<eventTime>:<clientId>:<eventIndex>:<logRecord>}