Skip to main content

PluginTemplateStore

Trait PluginTemplateStore 

Source
pub trait PluginTemplateStore: Send + Sync {
    // Required methods
    fn save<'life0, 'life1, 'async_trait>(
        &'life0 self,
        template: &'life1 ExtractionTemplate,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<ExtractionTemplate>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ExtractionTemplate>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn search<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ExtractionTemplate>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Port for persisting and retrieving extraction templates

Implementations handle storage (file, database, cloud) and lifecycle management.

§Example

use stygian_plugin::ports::PluginTemplateStore;
use stygian_plugin::domain::ExtractionTemplate;
let template = ExtractionTemplate::new("Product Extractor");
store.save(&template).await?;
let retrieved = store.get(&template.id).await?;
assert_eq!(template.id, retrieved.id);

Required Methods§

Source

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

Save or update a template

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = Result<ExtractionTemplate>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve a template by ID

Source

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

List all templates

Source

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

Delete a template by ID

Provided Methods§

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExtractionTemplate>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Search templates by name (substring match)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§