20#ifndef ORES_COMMS_RECORDING_SESSION_RECORDER_HPP
21#define ORES_COMMS_RECORDING_SESSION_RECORDER_HPP
30#include <boost/uuid/uuid.hpp>
31#include "ores.logging/make_logger.hpp"
32#include "ores.comms/messaging/frame.hpp"
33#include "ores.comms/recording/session_file.hpp"
62 inline static std::string_view logger_name =
"ores.comms.recording.session_recorder";
66 static auto instance = make_logger(logger_name);
93 std::expected<std::filesystem::path, session_file_error>
start(
94 const std::filesystem::path& output_directory,
95 const std::string& server_address,
153 const std::string& server_address,
161 mutable std::mutex mutex_;
163 std::filesystem::path file_path_;
164 boost::uuids::uuid session_id_;
165 std::chrono::steady_clock::time_point start_time_;
166 std::atomic<bool> recording_{
false};
167 std::atomic<std::uint64_t> frame_count_{0};
compression_type
Compression algorithm used for payload compression.
Definition message_types.hpp:259
Session recording infrastructure for debugging and analysis.
Definition ores.comms.recording.hpp:28
session_file_error
Error codes for session file operations.
Definition session_file.hpp:119
frame_direction
Direction of a recorded frame.
Definition session_file.hpp:50
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Complete frame with header and payload.
Definition frame.hpp:77
Records communication frames to a session file.
Definition session_recorder.hpp:60
void record_received(const messaging::frame &f)
Record a frame that was received by the client.
Definition session_recorder.cpp:112
bool is_recording() const
Check if recording is currently active.
Definition session_recorder.cpp:104
void record_sent(const messaging::frame &f)
Record a frame that was sent by the client.
Definition session_recorder.cpp:108
void stop()
Stop recording and close the session file.
Definition session_recorder.cpp:89
std::expected< std::filesystem::path, session_file_error > start(const std::filesystem::path &output_directory, const std::string &server_address, messaging::compression_type compression=messaging::compression_type::none)
Start recording to a new session file.
Definition session_recorder.cpp:36
std::uint64_t frame_count() const
Get the number of frames recorded so far.
Definition session_recorder.cpp:126
std::filesystem::path file_path() const
Get the path to the current recording file.
Definition session_recorder.cpp:121
boost::uuids::uuid session_id() const
Get the session ID for the current recording.
Definition session_recorder.cpp:116