19#include "sinks/Sink.hpp"
21#include <dfx-core/messages/Message.hpp>
22#include <dfx-fdwatch/PollerFd.hpp>
23#include <dfx-fdwatch/EPollPoller.hpp>
24#include <dfx-fdwatch/Timer.hpp>
25#include <dfx-utilities/UUIDGenerator.hpp>
195 void _onCleanupTimerTimeout();
196 void _onQueueDataReady();
197 void _handleNewSink(
SinkPtr & sink);
199 void _sinkWriteData(
std::vector<uint8_t> const & data);
203 std::mutex _mutexQueue;
206 std::mutex _mutexSink;
208 std::
string _userAppInfo;
209 std::
string _hardwareInfo;
223 std::jthread _thread;
Base class for all runtime-executed nodes in a dfx dataflow graph.
uint32_t Id
Node identifier type (unique and stable within a graph instance).
Definition Node.hpp:113
Mode
Port direction.
Definition Port.hpp:74
uint32_t Id
Identifier type of a port (unique within a node by not unique accross a graph).
Definition Port.hpp:69
void setPipeSink(SinkPtr pipeSink)
Install or replace the pipe sink.
~Worker()
Stop the worker thread and release all resources. Ensures the thread is terminated and the poller/tim...
void setFileSink(SinkPtr fileSink)
Install or replace the file sink.
void clearHwAndOsInfo() noexcept
Disable (or remove) hardware/OS metadata in the capture output. This only affects metadata emission; ...
void setTcpSink(SinkPtr tcpSink)
Install or replace the TCP sink.
Worker(bool getHwAndOsInfo)
Construct and start the worker thread.
SinkIndex
Index of supported sinks.
Definition Worker.hpp:80
@ Count
Number of sink slots.
Definition Worker.hpp:85
@ File
File output (offline capture). See FileSink.
Definition Worker.hpp:81
@ Pipe
Pipe output (live capture into another process). See PipeSink.
Definition Worker.hpp:82
@ Tcp
TCP output (stream capture to a remote consumer). See TcpSink.
Definition Worker.hpp:83
void pushData(QueueData data)
Push a capture item into the worker queue.
void setUserAppInfo(std::string info)
Set application-specific information to embed into capture metadata.
std::unique_ptr< Message > MessagePtr
Unique ownership handle for messages.
Definition Message.hpp:27
Definition SocketClient.hpp:23
Definition Capture.hpp:27
std::unique_ptr< Sink > SinkPtr
Owning pointer type for sinks.
Definition Sink.hpp:122
Definition SystemConfigCommandHandler.hpp:15
One capture item describing a message event and its context.
Definition Worker.hpp:112
Utils::UUID uuid
Identifier used to correlate and track pending items.
Definition Worker.hpp:116
Core::Node::Id nodeId
Stable node id.
Definition Worker.hpp:121
Core::Port::Mode portMode
Input vs output.
Definition Worker.hpp:128
Core::Port::Id portId
Stable port id.
Definition Worker.hpp:126
Core::MessagePtr message
Message payload.
Definition Worker.hpp:114
uint32_t counter
Worker-internal counter (tracking/aggregation).
Definition Worker.hpp:131
std::string portName
Human-readable port name.
Definition Worker.hpp:124
uint8_t timeoutCounter
Expiration counter, in 100ms units (10 => ~1s).
Definition Worker.hpp:133
std::string nodeName
Human-readable node name.
Definition Worker.hpp:119
Sink storage and "new sink" marker for hot swapping.
Definition Worker.hpp:95
SinkPtr sink
<
Definition Worker.hpp:97
std::atomic_bool isNew
True if this sink was just installed/replaced and must be handled by the worker thread.
Definition Worker.hpp:100
128-bit UUID value type.
Definition UUIDGenerator.hpp:33