Struct routinator::engine::Engine
source · pub struct Engine { /* private fields */ }
Expand description
The mechanism to update and process RPKI data.
A validation value can be created from the configuration via
Engine::new
. If you don’t actually want to perform a validation run
but just initialize everything, Engine::init
will suffice.
When created, the set of TALs is loaded and kept around. It will only be
refreshed explicitly through the reload_tals
method.
Before starting the very first validation run, you need to call
ignite
at least once. As this may spawn threads, this
must happen after a possible fork.
A run is started via the start
method, providing a
processor that handles valid data. The method returns a Run value that
drives the validation run.
Implementations§
source§impl Engine
impl Engine
sourcepub fn init(config: &Config) -> Result<(), Failed>
pub fn init(config: &Config) -> Result<(), Failed>
Initializes the engine without creating a value.
This ensures that the TAL directory is present and logs a hint how to achieve that if not.
The function is called implicitly by new
.
sourcepub fn new(config: &Config, update: bool) -> Result<Self, Failed>
pub fn new(config: &Config, update: bool) -> Result<Self, Failed>
Creates a new engine.
Takes all necessary information from config
.
It also takes over the provided cache and store for use during
validation.
Loads the initial set of TALs and errors out if that fails.
sourcepub fn reload_tals(&mut self) -> Result<(), Failed>
pub fn reload_tals(&mut self) -> Result<(), Failed>
Reloads the set of TALs.
Assumes that all regular files with an extension of tal
in the
TAL directory specified during object creation are TAL files and
tries to load and decode them. Fails if that fails for at least one
of those files.
It is not considered an error if there are no TAL files in the TAL directory. However, a warning will be logged in this case.
sourcepub fn ignite(&mut self) -> Result<(), Failed>
pub fn ignite(&mut self) -> Result<(), Failed>
Ignites validation processing.
This spawns threads and therefore needs to be done after a possible fork.
sourcepub fn start<P: ProcessRun>(&self, processor: P) -> Result<Run<'_, P>, Failed>
pub fn start<P: ProcessRun>(&self, processor: P) -> Result<Run<'_, P>, Failed>
Starts a validation run.
During the run, processor
will be responsible for dealing with
valid objects. It must implement the ProcessRun
trait.
The method returns a Run
that drives the validation run.