DatabaseSignature

Trait DatabaseSignature 

Source
pub trait DatabaseSignature<OF: ObservedFingerprint> {
    // Required methods
    fn calculate_distance(&self, observed: &OF) -> Option<u32>;
    fn get_quality_score(&self, distance: u32) -> f32;
    fn generate_index_keys_for_db_entry(&self) -> Vec<OF::Key>;
}
Expand description

A fingerprint signature as defined in a database. OF is the type of ObservedFingerprint that this database signature can be compared against.

Required Methods§

Source

fn calculate_distance(&self, observed: &OF) -> Option<u32>

Calculates a distance or dissimilarity score. Lower is better.

Source

fn get_quality_score(&self, distance: u32) -> f32

Returns the quality score based on the distance.

Source

fn generate_index_keys_for_db_entry(&self) -> Vec<OF::Key>

Generates index keys from this database signature. It’s a Vec because some DB signatures (like IpVersion::Any) might map to multiple keys. The OptionOF::Key in the Vec allows for cases where a specific DB sig might not produce a key for a certain specific version (e.g. an IpVersion::Any sig, when asked to produce a V4 key, will).

Implementors§