23 lines
797 B
Rust
23 lines
797 B
Rust
// file: kb-lib/src/materializer/api/materializer.rs
|
|
// version: 2
|
|
|
|
//! Materializer API contract used by business materializer crates.
|
|
|
|
/// Common contract implemented by all business materializer crates.
|
|
pub trait MtMaterializer {
|
|
/// Returns the stable materializer name.
|
|
fn materializer_name(&self) -> &'static str;
|
|
|
|
/// Returns the materializer version.
|
|
fn materializer_version(&self) -> &'static str;
|
|
|
|
/// Tests whether this materializer accepts a decoded event.
|
|
fn accepts_event(&self, event: &crate::MdDecodedProtocolEvent) -> bool;
|
|
|
|
/// Materializes a decoded event into zero or more business events.
|
|
fn materialize_event(
|
|
&self,
|
|
event: &crate::MdDecodedProtocolEvent,
|
|
) -> kb_core::Result<std::vec::Vec<crate::MdMaterializedEvent>>;
|
|
}
|