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§
Sourcefn metadata(&self) -> &PluginMetadata
fn metadata(&self) -> &PluginMetadata
Get plugin metadata
Provided Methods§
Sourcefn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.
Sourcefn shutdown<'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,
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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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,
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.