Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
Show 13 methods // Required method fn metadata(&self) -> &PluginMetadata; // Provided methods fn init<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn before_create_node<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn after_create_node<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn before_create_session<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn after_create_session<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn before_query<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn after_query<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn before_create_edge<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn after_create_edge<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn before_hook<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hook_name: &'life1 str, context: &'life2 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn after_hook<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hook_name: &'life1 str, context: &'life2 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... }
}
Expand description

Plugin trait - all plugins must implement this

Plugins can selectively implement hooks they’re interested in. All hooks are async and return a Result to allow for error handling.

Required Methods§

Source

fn metadata(&self) -> &PluginMetadata

Get plugin metadata

Provided Methods§

Source

fn init<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initialize plugin

Called once when the plugin is registered and enabled. Use this to set up any resources, connections, or state. Plugins should use interior mutability (e.g., Mutex, RwLock) for any state changes.

Source

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Shutdown plugin

Called when the plugin is being disabled or the system is shutting down. Use this to clean up resources, close connections, etc. Plugins should use interior mutability (e.g., Mutex, RwLock) for any state changes.

Source

fn before_create_node<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hook: Before node creation

Called before a node is created in the graph. Can be used for validation, transformation, or enrichment.

Source

fn after_create_node<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hook: After node creation

Called after a node is successfully created. Can be used for logging, notifications, or follow-up actions.

Source

fn before_create_session<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hook: Before session creation

Called before a session is created. Can be used for validation, quota checking, or initialization.

Source

fn after_create_session<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hook: After session creation

Called after a session is successfully created. Can be used for registration, logging, or setup.

Source

fn before_query<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hook: Before query execution

Called before a query is executed. Can be used for query validation, transformation, or access control.

Source

fn after_query<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hook: After query execution

Called after a query is successfully executed. Can be used for result transformation, caching, or logging.

Source

fn before_create_edge<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hook: Before edge creation

Called before an edge is created in the graph. Can be used for relationship validation or enforcement.

Source

fn after_create_edge<'life0, 'life1, 'async_trait>( &'life0 self, _context: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hook: After edge creation

Called after an edge is successfully created. Can be used for graph analysis or notifications.

Source

fn before_hook<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hook_name: &'life1 str, context: &'life2 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Generic hook execution (before)

Routes to the appropriate before hook based on the hook name.

Source

fn after_hook<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hook_name: &'life1 str, context: &'life2 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Generic hook execution (after)

Routes to the appropriate after hook based on the hook name.

Implementors§