0.1.0
This commit is contained in:
22
kb-lib/src/materializer/api/materializer.rs
Normal file
22
kb-lib/src/materializer/api/materializer.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
// 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 Materializer {
|
||||
/// 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::DecodedProtocolEvent) -> bool;
|
||||
|
||||
/// Materializes a decoded event into zero or more business events.
|
||||
fn materialize_event(
|
||||
&self,
|
||||
event: &crate::DecodedProtocolEvent,
|
||||
) -> kb_core::Result<std::vec::Vec<crate::MaterializedEvent>>;
|
||||
}
|
||||
Reference in New Issue
Block a user