VLink  2.1.0
A high-performance communication middleware
vlink::TriggerPluginInterface类 参考abstract

Abstract plugin base notified across a TriggerRecorder's life cycle and dump pipeline. 更多...

#include <trigger_plugin_interface.h>

vlink::TriggerPluginInterface 的协作图:

struct  DumpContext
 Describes the dump currently being written, delivered to on_dump_started() / on_frame(). 更多...
 
struct  DumpResult
 Final outcome of a dump, delivered to on_dump_finished() / on_dump_failed(). 更多...
 
struct  TriggerContext
 Describes an accepted trigger request, delivered to on_trigger(). 更多...
 

Public 成员函数

virtual bool init (const std::string &config)=0
 Initialises the plugin with an opaque configuration string. 更多...
 
virtual void on_start ()
 Notifies the plugin that the recorder has started. 更多...
 
virtual void on_stop ()
 Notifies the plugin that the recorder is stopping. 更多...
 
virtual void on_trigger (const TriggerContext &context)
 Notifies the plugin that a trigger was accepted and a dump is about to run. 更多...
 
virtual void on_dump_started (const DumpContext &context)
 Notifies the plugin that the output file has been opened and writing is beginning. 更多...
 
virtual void on_frame (const Frame &frame, const DumpContext &context)
 Inspects each frame as it is submitted to the writer (hot path). 更多...
 
virtual void on_dump_finished (const DumpResult &result)=0
 Notifies the plugin that the dump file has been fully written and closed. 更多...
 
virtual void on_dump_failed (const DumpResult &result)
 Notifies the plugin that a dump was aborted before completion. 更多...
 
virtual void on_file_rotated (const std::string &path)
 Notifies the plugin that an old dump file was removed by rotation. 更多...
 
virtual void flush ()
 Drains any plugin-internal asynchronous work before the host unbinds or tears down. 更多...
 

Protected 成员函数

 TriggerPluginInterface ()=default
 
virtual ~TriggerPluginInterface ()=default
 

详细描述

Abstract plugin base notified across a TriggerRecorder's life cycle and dump pipeline.

The host binds an instance through TriggerRecorder::bind_trigger_interface() and calls each hook at the corresponding stage. Implementations provide init() and on_dump_finished(); the remaining hooks have default no-op implementations. Implementations must follow the threading contract documented above.

构造及析构函数说明

◆ TriggerPluginInterface()

vlink::TriggerPluginInterface::TriggerPluginInterface ( )
protecteddefault

◆ ~TriggerPluginInterface()

virtual vlink::TriggerPluginInterface::~TriggerPluginInterface ( )
protectedvirtualdefault

成员函数说明

◆ flush()

void vlink::TriggerPluginInterface::flush ( )
inlinevirtual

Drains any plugin-internal asynchronous work before the host unbinds or tears down.

Invoked by the host while the plugin is still valid, right before it detaches this plugin (at recorder stop / teardown). A plugin that offloads work to a background worker (e.g. an upload queue) must override this to finish or checkpoint that work synchronously, so pending uploads are not lost. Default: no-op.

◆ init()

virtual bool vlink::TriggerPluginInterface::init ( const std::string &  config)
pure virtual

Initialises the plugin with an opaque configuration string.

Called once by a plugin-loading host before the plugin is bound to a recorder. The string may be a file path, JSON document or any other format defined by the plugin. Programmatically constructed plugins call this method themselves when configuration is required.

参数
configPlugin-defined configuration; may be empty.
返回
true on success; false makes the host reject the plugin.

◆ on_dump_failed()

void vlink::TriggerPluginInterface::on_dump_failed ( const DumpResult result)
inlinevirtual

Notifies the plugin that a dump was aborted before completion.

Invoked on the recorder's loop thread when the writer could not be created, the write failed, or an accepted delayed dump was abandoned during shutdown. Default: no-op.

参数
resultDump outcome, with success set to false and error describing the failure.

◆ on_dump_finished()

virtual void vlink::TriggerPluginInterface::on_dump_finished ( const DumpResult result)
pure virtual

Notifies the plugin that the dump file has been fully written and closed.

The primary lifecycle hook: invoked on the recorder's loop thread once the bag is finalised. The place to upload, archive, or notify. Slow work here blocks the next dump – offload to a worker and drain it in flush().

参数
resultFinal dump outcome, with success set to true.

◆ on_dump_started()

void vlink::TriggerPluginInterface::on_dump_started ( const DumpContext context)
inlinevirtual

Notifies the plugin that the output file has been opened and writing is beginning.

Invoked on the recorder's loop thread after the bag writer is created, before frames are written. Default: no-op.

参数
contextDump-in-progress details.

◆ on_file_rotated()

void vlink::TriggerPluginInterface::on_file_rotated ( const std::string &  path)
inlinevirtual

Notifies the plugin that an old dump file was removed by rotation.

Invoked on the recorder's loop thread each time file rotation deletes an aged-out dump, so a plugin mirroring files to a backend can mirror the deletion. Default: no-op.

参数
pathPath of the file that was deleted.

◆ on_frame()

void vlink::TriggerPluginInterface::on_frame ( const Frame frame,
const DumpContext context 
)
inlinevirtual

Inspects each frame as it is submitted to the writer (hot path).

Invoked on the recorder's loop thread once per frame successfully handed to the writer, in ascending capture-time order. A frame the writer fails to persist aborts the dump and is not reported here. This observes submission, not final persistence: a bound bag reorder plugin may still reorder or drop the frame downstream before it reaches disk. Runs for potentially many frames, so keep the implementation cheap; it cannot alter or drop the frame. Default: no-op.

参数
frameSubmitted frame (payload is a shallow view valid for the call).
contextDump-in-progress details.

◆ on_start()

void vlink::TriggerPluginInterface::on_start ( )
inlinevirtual

Notifies the plugin that the recorder has started.

Details

Invoked on the recorder's loop thread during TriggerRecorder::async_run(), after discovery is running. A place to acquire long-lived resources such as an upload session. Default: no-op.

◆ on_stop()

void vlink::TriggerPluginInterface::on_stop ( )
inlinevirtual

Notifies the plugin that the recorder is stopping.

Invoked on the recorder's loop thread during shutdown. A place to release resources acquired in on_start(). Default: no-op.

◆ on_trigger()

void vlink::TriggerPluginInterface::on_trigger ( const TriggerContext context)
inlinevirtual

Notifies the plugin that a trigger was accepted and a dump is about to run.

Invoked on the recorder's loop thread after the requested window has been snapshotted and before the bag writer is opened. Slow work delays persistence but does not change the captured window. Default: no-op.

参数
contextAccepted trigger request details.

该类的文档由以下文件生成: