// ============================================================================ // AUTO-GENERATED FILE - DO NOT EDIT MANUALLY // ============================================================================ // This file is automatically generated by build.rs during compilation. // Any manual changes will be overwritten on the next build. // // To add a new plugin/hook: // 1. Create a new .rs file in the appropriate directory (plugins/ or hooks/) // 2. Implement the required traits and register() function // 3. Run `cargo build` - this file will be regenerated automatically // ============================================================================ //! Plugin infrastructure for Lore Server modularization. //! //! This module provides a compile-time plugin system that supports swappable //! storage backends and topology discovery mechanisms. The plugin system //! uses factory traits that can be implemented by different crates and //! registered at application startup based on compile-time feature flags. //! //! # Architecture //! //! The plugin system consists of three main components: //! //! 1. **Factory Traits** ([`traits`]) - Define the interface for creating plugin instances //! 2. **Plugin Registry** ([`registry`]) - Central hub for registering and creating plugins //! 3. **Error Types** ([`PluginError`]) - Error types for plugin operations //! //! # Plugin Types //! //! The system supports four types of plugins: //! //! - **Immutable Store** - Backend for storing immutable data (e.g., local filesystem, S3) //! - **Mutable Store** - Backend for storing mutable data (e.g., local filesystem, `DynamoDB`) //! - **Lock Store** - Backend for distributed locking (e.g., local filesystem, `DynamoDB`) //! - **Topology** - Service discovery mechanism (e.g., fixed list, Consul) //! //! # Usage //! //! ## Registering Plugins //! //! Plugins are typically registered at application startup: //! //! ``` //! use lore_server::plugins::PluginRegistry; //! //! let mut registry = PluginRegistry::new(); //! //! // Register all compiled-in plugins (populated by build.rs) //! lore_server::plugins::register_all_plugins(&mut registry); //! //! // List registered plugins //! let plugins = registry.list_immutable_store_plugins(); //! ``` //! //! ## Creating Plugin Instances //! //! ``` //! use lore_server::plugins::PluginRegistry; //! //! let registry = PluginRegistry::new(); //! //! // Try to create a plugin (would fail if 'local' is not registered) //! let config: toml::Value = toml::from_str(r#" //! path = '/data/store' //! max_capacity = 1000000 //! "#).unwrap(); //! //! // In a real scenario with registered plugins: //! // let store = registry.create_immutable_store("local", &config)?; //! //! // List what's available //! let available = registry.list_immutable_store_plugins(); //! ``` //! //! # Error Handling //! //! [`PluginError`] is an `error_set` enum with three named variants: //! //! - `PluginNotFound` - Requested plugin is not compiled in //! - `PluginConfigError` - Configuration validation failed //! - `PluginInitError` - Plugin initialization failed //! //! Callers can match via the generated `.is_plugin_not_found()` / //! `.is_plugin_config_error()` / `.is_plugin_init_error()` accessors. pub mod registry; pub mod traits; // Auto-discovered plugin modules pub mod aws; pub mod hashicorp; // Re-export commonly used items at the module level pub use registry::PluginRegistry; pub use traits::ImmutableStorePluginFactory; pub use traits::LockStorePluginFactory; pub use traits::MutableStorePluginFactory; pub use traits::NotificationPlugin; pub use traits::NotificationPluginContext; pub use traits::NotificationPluginFactory; pub use traits::NotificationReceiver; pub use traits::PluginError; pub use traits::TopologyPluginFactory; /// Registers all compiled-in plugins with the registry. /// /// This function is auto-generated by `build.rs` and calls each plugin's /// `register()` function to register its factories with the registry. /// /// # Arguments /// /// * `registry` - The plugin registry to register plugins with /// /// # Example /// /// ``` /// use lore_server::plugins::PluginRegistry; /// /// let mut registry = PluginRegistry::new(); /// lore_server::plugins::register_all_plugins(&mut registry); /// /// // Registry now contains plugins discovered by build.rs /// // In tests, this may be empty if no plugins are compiled in /// let stores = registry.list_immutable_store_plugins(); /// ``` pub fn register_all_plugins(registry: &mut PluginRegistry) { aws::register(registry); hashicorp::register(registry); }