[][src]Trait fluentbit::FLBPluginMethods

pub trait FLBPluginMethods {
    fn plugin_register(&mut self, info: &mut PluginInfo) -> FLBResult;
fn plugin_init(&mut self) -> FLBResult;
fn plugin_flush(&mut self, data: &[u8]) -> FLBResult;
fn plugin_exit(&mut self) -> FLBResult; }

Trait which defines the functions that should be implemented by any rust plugin

Required methods

fn plugin_register(&mut self, info: &mut PluginInfo) -> FLBResult

A plugin register method

When the FLBPluginInit is triggered by Fluent Bit, a plugin context is passed and the next step is to invoke this FLBPluginRegister() function to fill the required information: name and description.

Arguments

  • info A mutable reference to a PluginInfo struct where the plugin's name and description will be filled

Returns

If the operation was successful an Ok(()) is returned otherwise FLBError

fn plugin_init(&mut self) -> FLBResult

Before the engine starts, it initialize all plugins that were requested to start Useful for initializing any data structure that would be used for this plugin during the processing

Returns

If the operation was successful an Ok(()) is returned otherwise FLBError

fn plugin_flush(&mut self, data: &[u8]) -> FLBResult

Upon flush time, when Fluent Bit want's to flush it buffers, the runtime flush callback will be triggered. The callback will receive a raw buffer of msgpack data. The passed data is a bytes buffer which could be processed in anyway. A there are differents crates that would be helpful in the ecosystem, such as rmp, msgpack or you can implement a custom parser by using one of most parser libraries in the rust ecosystem.

Arguments

  • data A byte buffer with the message in a MsgPack format

Returns

If the operation was successful an Ok(()) is returned otherwise FLBError

fn plugin_exit(&mut self) -> FLBResult

When Fluent Bit will stop using the instance of the plugin, it will trigger the exit callback.

Returns

If the operation was successful an Ok(()) is returned otherwise FLBError

Loading content...

Implementors

Loading content...