18#include "sinks/Sink.hpp"
20#include <dfx-core/messages/Message.hpp>
21#include <dfx-fdwatch/PollerFd.hpp>
22#include <dfx-fdwatch/EPollPoller.hpp>
23#include <dfx-fdwatch/Timer.hpp>
24#include <dfx-utilities/UUIDGenerator.hpp>
185 void exec(std::stop_token stopToken);
197 void _onCleanupTimerTimeout();
198 void _onQueueDataReady();
199 void _handleNewSink(
SinkPtr & sink);
201 void _sinkWriteData(
std::vector<uint8_t> const & data);
208 std::mutex _mutexQueue;
211 std::mutex _mutexSink;
213 std::
string _userAppInfo;
214 std::
string _hardwareInfo;
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:116
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 exec(std::stop_token stopToken)
Starts the internal event loop and take ownership of the current thread.
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:79
@ Count
Number of sink slots.
Definition Worker.hpp:84
@ File
File output (offline capture). See FileSink.
Definition Worker.hpp:80
@ Pipe
Pipe output (live capture into another process). See PipeSink.
Definition Worker.hpp:81
@ Tcp
TCP output (stream capture to a remote consumer). See TcpSink.
Definition Worker.hpp:82
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:28
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:111
Utils::UUID uuid
Identifier used to correlate and track pending items.
Definition Worker.hpp:115
Core::Node::Id nodeId
Stable node id.
Definition Worker.hpp:120
Core::Port::Mode portMode
Input vs output.
Definition Worker.hpp:127
Core::Port::Id portId
Stable port id.
Definition Worker.hpp:125
Core::MessagePtr message
Message payload.
Definition Worker.hpp:113
uint32_t counter
Worker-internal counter (tracking/aggregation).
Definition Worker.hpp:130
std::string portName
Human-readable port name.
Definition Worker.hpp:123
uint8_t timeoutCounter
Expiration counter, in 100ms units (10 => ~1s).
Definition Worker.hpp:132
std::string nodeName
Human-readable node name.
Definition Worker.hpp:118
Sink storage and "new sink" marker for hot swapping.
Definition Worker.hpp:94
SinkPtr sink
<
Definition Worker.hpp:96
std::atomic_bool isNew
True if this sink was just installed/replaced and must be handled by the worker thread.
Definition Worker.hpp:99
128-bit UUID value type.
Definition UUIDGenerator.hpp:33