feat: worker plugin system — domain ports, pipeline executor, built-in plugins
- PluginExecutor + PluginRegistry ports in domain - ExecutePipelineCommand orchestrates job→pipeline→plugin steps - ProcessNextJobCommand polls + executes next queued job - InMemoryPluginRegistry, NoOp/MetadataExtractor/SidecarSync plugins - Worker main rewritten with poll loop, factories module for DI - Deleted template job/runner/jobs remnants
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
use super::entities::{Job, JobBatch, Plugin, ProcessingPipeline};
|
||||
use crate::common::errors::DomainError;
|
||||
use crate::common::value_objects::SystemId;
|
||||
use crate::common::value_objects::{StructuredData, SystemId};
|
||||
use async_trait::async_trait;
|
||||
use std::sync::Arc;
|
||||
|
||||
// --- JobRepository ---
|
||||
|
||||
@@ -38,3 +39,23 @@ pub trait PipelineRepository: Send + Sync {
|
||||
async fn find_by_trigger(&self, event: &str) -> Result<Vec<ProcessingPipeline>, DomainError>;
|
||||
async fn save(&self, pipeline: &ProcessingPipeline) -> Result<(), DomainError>;
|
||||
}
|
||||
|
||||
// --- PluginExecutor ---
|
||||
|
||||
#[async_trait]
|
||||
pub trait PluginExecutor: Send + Sync {
|
||||
fn plugin_name(&self) -> &str;
|
||||
async fn execute(
|
||||
&self,
|
||||
asset_id: Option<SystemId>,
|
||||
payload: &StructuredData,
|
||||
config: &StructuredData,
|
||||
) -> Result<StructuredData, DomainError>;
|
||||
}
|
||||
|
||||
// --- PluginRegistry ---
|
||||
|
||||
pub trait PluginRegistry: Send + Sync {
|
||||
fn get_executor(&self, plugin_name: &str) -> Option<Arc<dyn PluginExecutor>>;
|
||||
fn registered_plugins(&self) -> Vec<String>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user