pub trait DataSourcePlugin: Send + Sync {
// Required methods
fn capabilities(&self) -> PluginCapabilities;
fn initialize<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn connect<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
config: &'life2 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<DataConnection>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn query<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
connection: &'life2 DataConnection,
query: &'life3 DataQuery,
config: &'life4 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<DataResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn get_schema<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
connection: &'life2 DataConnection,
config: &'life3 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<Schema>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn test_connection<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
config: &'life2 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<ConnectionTestResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn validate_config(&self, config: &DataSourcePluginConfig) -> Result<()>;
fn supported_types(&self) -> Vec<String>;
fn cleanup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Data source plugin trait
Implement this trait to create custom data source integrations. Data source plugins enable MockForge to connect to external data sources like databases, REST APIs, files, and other systems for dynamic mocking.
Required Methods§
Sourcefn capabilities(&self) -> PluginCapabilities
fn capabilities(&self) -> PluginCapabilities
Get plugin capabilities (permissions and limits)
Sourcefn initialize<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn initialize<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Initialize the plugin with configuration
Sourcefn connect<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
config: &'life2 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<DataConnection>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn connect<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
config: &'life2 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<DataConnection>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn query<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
connection: &'life2 DataConnection,
query: &'life3 DataQuery,
config: &'life4 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<DataResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn query<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
connection: &'life2 DataConnection,
query: &'life3 DataQuery,
config: &'life4 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<DataResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Sourcefn get_schema<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
connection: &'life2 DataConnection,
config: &'life3 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<Schema>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_schema<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
connection: &'life2 DataConnection,
config: &'life3 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<Schema>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Sourcefn test_connection<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
config: &'life2 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<ConnectionTestResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn test_connection<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
config: &'life2 DataSourcePluginConfig,
) -> Pin<Box<dyn Future<Output = Result<PluginResult<ConnectionTestResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn validate_config(&self, config: &DataSourcePluginConfig) -> Result<()>
fn validate_config(&self, config: &DataSourcePluginConfig) -> Result<()>
Validate plugin configuration
Sourcefn supported_types(&self) -> Vec<String>
fn supported_types(&self) -> Vec<String>
Get supported data source types