pub struct SchemaClassifier { /* private fields */ }Expand description
Recognizes the schema of parsed events from a set of signatures.
Signatures are sorted once at construction (specificity descending, then
name ascending) so classify returns the best match with
a single in-order scan.
Implementations§
Source§impl SchemaClassifier
impl SchemaClassifier
Sourcepub fn new(signatures: Vec<SchemaSignature>) -> Self
pub fn new(signatures: Vec<SchemaSignature>) -> Self
Build a classifier from an explicit signature set.
Sourcepub fn with_user_signatures(user: Vec<SchemaSignature>) -> Self
pub fn with_user_signatures(user: Vec<SchemaSignature>) -> Self
Build a classifier from the built-ins plus user-supplied signatures. User signatures are added to (not replacing) the built-ins; a user signature with a higher specificity than a built-in wins on overlap.
Sourcepub fn classify<E: Event + ?Sized>(&self, event: &E) -> Option<SchemaMatch>
pub fn classify<E: Event + ?Sized>(&self, event: &E) -> Option<SchemaMatch>
Classify an event. Returns the highest-specificity matching schema, or
None when the event matches no signature (“unknown”).
Sourcepub fn classify_all<E: Event + ?Sized>(&self, event: &E) -> Vec<String>
pub fn classify_all<E: Event + ?Sized>(&self, event: &E) -> Vec<String>
All matching schema names for an event, most specific first. Useful for tuning signatures (seeing what else an event could match). Deduplicated by name while preserving order.
Sourcepub fn schema_names(&self) -> Vec<&str>
pub fn schema_names(&self) -> Vec<&str>
Distinct schema names this classifier can produce, most specific first.
Trait Implementations§
Source§impl Clone for SchemaClassifier
impl Clone for SchemaClassifier
Source§fn clone(&self) -> SchemaClassifier
fn clone(&self) -> SchemaClassifier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more