Trait jupiter::repository::loader::Loader
source · pub trait Loader: Display + Send + Sync {
// Required methods
fn file_changed<'life0, 'life1, 'async_trait>(
&'life0 self,
loader_info: &'life1 LoaderInfo
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn platform(&self) -> &Arc<Platform>;
// Provided methods
fn update_table<'life0, 'life1, 'async_trait>(
&'life0 self,
doc: Doc,
loader_info: &'life1 LoaderInfo
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn table_name<'a>(&self, loader_info: &'a LoaderInfo) -> Result<&'a str> { ... }
fn indices(&self, loader_info: &LoaderInfo) -> Vec<IndexType> { ... }
fn file_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
loader_info: &'life1 LoaderInfo
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}
Expand description
Describes a API of a loader.
A loader is informed once a file is either changed or deleted. Based on the given metadata (which is essentially the content of the YAML file in the loaders directory it can perform the required actions to either process the file or remove the data once the underlying file has been removed.
Required Methods§
sourcefn file_changed<'life0, 'life1, 'async_trait>(
&'life0 self,
loader_info: &'life1 LoaderInfo
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn file_changed<'life0, 'life1, 'async_trait>(
&'life0 self,
loader_info: &'life1 LoaderInfo
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invoked if either the loader metadata or the file itself has changed.
Provided Methods§
sourcefn update_table<'life0, 'life1, 'async_trait>(
&'life0 self,
doc: Doc,
loader_info: &'life1 LoaderInfo
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_table<'life0, 'life1, 'async_trait>(
&'life0 self,
doc: Doc,
loader_info: &'life1 LoaderInfo
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Can be invoked by loaders which store data in InfoGraphDB to update a table with the indices as defined by the metadata YAML.
sourcefn table_name<'a>(&self, loader_info: &'a LoaderInfo) -> Result<&'a str>
fn table_name<'a>(&self, loader_info: &'a LoaderInfo) -> Result<&'a str>
Extracts the table name from the given metadata.
This will parse the property table
and report its contents or raise an error
if the property is missing.
sourcefn indices(&self, loader_info: &LoaderInfo) -> Vec<IndexType>
fn indices(&self, loader_info: &LoaderInfo) -> Vec<IndexType>
Extracts the desired indices from the given metadata.
This will parse fulltextIndices
and indices
and will transform these lists into
a single list of indices to create for the table being registered in IDB.
sourcefn file_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
loader_info: &'life1 LoaderInfo
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn file_deleted<'life0, 'life1, 'async_trait>(
&'life0 self,
loader_info: &'life1 LoaderInfo
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invoked if the underlying file or the loader itself was deleted.
By default the associated table from IDB will be removed.