116 #include <string_view>
117 #include <unordered_map>
118 #include <unordered_set>
121 #include "../base/message_loop.h"
122 #include "../subscriber.h"
127 class BagPluginInterface;
128 class TriggerPluginInterface;
172 static constexpr int64_t kMaxWindowMs = std::numeric_limits<int64_t>::max() / 4000;
205 int64_t max_packet_size{-1};
206 int64_t max_size{-1};
207 bool only_front{
false};
208 bool only_back{
false};
220 int64_t default_pre_ms{15'000};
221 int64_t default_post_ms{0};
222 int64_t default_max_packet_size{4LL * 1024 * 1024};
223 int64_t default_max_size{0};
224 int64_t max_cache_size{2LL * 1024 * 1024 * 1024};
225 int64_t retention_guard_ms{500};
226 int max_dump_file_count{10};
227 bool enable_compress{
false};
228 bool busy_skip_data{
false};
229 bool destroy_on_offline{
false};
231 int64_t sleep_interval{4LL * 1024 * 1024};
232 int64_t sleep_time_ms{0};
254 bool black_mode{
false};
330 void clear_trigger_interface();
350 void clear_bag_interface();
353 void on_begin() override;
355 void on_end() override;
362 void handle_data(UrlBuffer& url_buffer, const
Bytes& data);
364 std::shared_ptr<UrlBuffer> build_url_buffer(const
DiscoveryViewer::Info& info);
366 std::shared_ptr<
RawSub> deactivate_url_buffer(UrlBuffer& url_buffer);
368 void recompute_retention();
374 void finish_dump(DumpJob& job);
376 void finish_dump_locked(DumpJob& job);
378 void notify_dump_failed(const DumpJob& job, std::string_view error);
380 void do_dump(DumpJob& job);
382 std::unique_ptr<Impl> impl_;
Abstract plugin base shared by bag playback and bag recording.
Definition: bag_plugin_interface.h:154
Fixed-size 128-byte buffer holder with SBO, five ownership modes and integrated codecs.
Definition: bytes.h:120
MessageLoop-based aggregator of live VLink endpoint announcements.
Definition: discovery_viewer.h:92
FilterType
Selects which announcements contribute to the live snapshot.
Definition: discovery_viewer.h:103
@ kFilterAvailable
Drop remote announcements for local-only URL schemes.
Definition: discovery_viewer.h:105
Copyable type-erased callable analogue of std::function with a tunable SBO and pool spill.
Definition: functional.h:132
Serial task dispatcher with selectable queue backend and bounded timer registry.
Definition: message_loop.h:126
Type-safe topic listener for the VLink event communication model.
Definition: subscriber.h:148
Abstract plugin base notified across a TriggerRecorder's life cycle and dump pipeline.
Definition: trigger_plugin_interface.h:103
MessageLoop-based rolling in-memory recorder that dumps a pre/post window to a bag on trigger.
Definition: trigger_recorder.h:140
TriggerRecorder(const Config &config, RawSubFactory &&factory)
Builds the recorder and acquires every fallible resource; the loop is not running yet.
bool dump(const TriggerParams ¶ms, std::string &out_file)
Requests a dump and returns its selected output path when accepted.
OverflowPolicy
What to do when a byte cap (per-URL max_size or global max_cache_size) would be exceeded.
Definition: trigger_recorder.h:184
FileType
On-disk container format for the dumped bag.
Definition: trigger_recorder.h:193
bool dump(const TriggerParams ¶ms={})
Requests a dump of the pre/post window around the current instant.
bool is_dumping() const noexcept
Reports whether a dump is currently in flight.
~TriggerRecorder() override
Requests quit and joins the recorder loop thread.
Live aggregator of VLink endpoint announcements emitted by DiscoveryReporter.
#define VLINK_EXPORT
Definition: macros.h:81
#define VLINK_DISALLOW_COPY_AND_ASSIGN(classname)
Deletes the copy constructor and copy-assignment operator of classname.
Definition: macros.h:174
InitType
Selects between immediate and deferred node initialisation.
Definition: types.h:150
Recorder-wide configuration; passed once to the constructor and read-only afterwards.
Definition: trigger_recorder.h:217
std::vector< std::string > blacklist
These exact URLs are never recorded.
Definition: trigger_recorder.h:235
std::unordered_map< std::string, UrlConfig > url_overrides
Per-URL window / limit overrides.
Definition: trigger_recorder.h:236
std::string dump_dir
Output directory; empty => {tmp}/vlink-trigger.
Definition: trigger_recorder.h:218
std::vector< std::string > whitelist
If non-empty, only these exact URLs are recorded.
Definition: trigger_recorder.h:234
Config()
Definition: trigger_recorder.h:238
Per-trigger parameters; a pure data struct with no RPC or protobuf dependency.
Definition: trigger_recorder.h:245
std::unordered_set< std::string > whitelist
Exact URL whitelist; empty means all URLs pass this stage.
Definition: trigger_recorder.h:251
TriggerParams()
Definition: trigger_recorder.h:256
std::string filter_str
Secondary comma/space-separated substring filter.
Definition: trigger_recorder.h:253
std::string reason
Human-readable trigger reason; stored as the bag tag.
Definition: trigger_recorder.h:246
std::string out_file
Explicit output path; when empty a name under dump_dir is generated.
Definition: trigger_recorder.h:248
std::string name_hint
Optional base name; a numeric suffix is added rather than replacing an existing bag.
Definition: trigger_recorder.h:247
std::unordered_set< std::string > blacklist
Exact URL blacklist applied after whitelist.
Definition: trigger_recorder.h:252
Per-URL overrides; any field left negative falls back to the matching Config default.
Definition: trigger_recorder.h:202
UrlConfig()
Definition: trigger_recorder.h:210