pub enum TemplateEvent {
Learned {
template_id: u16,
protocol: TemplateProtocol,
},
Collision {
template_id: u16,
protocol: TemplateProtocol,
},
Evicted {
template_id: u16,
protocol: TemplateProtocol,
},
Expired {
template_id: u16,
protocol: TemplateProtocol,
},
MissingTemplate {
template_id: u16,
protocol: TemplateProtocol,
},
}Expand description
Template lifecycle events.
These events are emitted during template cache operations and allow users to monitor and react to template state changes.
Variants§
Learned
A new template was learned and added to the cache.
This event fires when a template definition packet is successfully parsed and the template is inserted into the cache for the first time.
Fields
protocol: TemplateProtocolThe protocol (V9 or IPFIX)
Collision
A template ID was reused, potentially with a different definition.
This event indicates that a template ID already in the cache was encountered again. This could be:
- The same template being re-sent (normal refresh)
- A different template using the same ID (collision - problematic)
In multi-source deployments without proper scoping, collisions indicate
that different routers are using the same template ID with potentially
different schemas. Use AutoScopedParser to avoid this issue.
Fields
protocol: TemplateProtocolThe protocol (V9 or IPFIX)
Evicted
A template was evicted from the cache due to LRU policy.
When the cache reaches its maximum size, the least recently used template is evicted to make room for new templates. Frequent evictions may indicate that the cache size is too small or that there are too many active templates.
Fields
protocol: TemplateProtocolThe protocol (V9 or IPFIX)
Expired
A template expired due to TTL timeout.
When TTL-based template expiration is enabled, templates that haven’t been used within the configured timeout are automatically removed from the cache. This is useful for handling exporters that may change their template definitions without notification.
Fields
protocol: TemplateProtocolThe protocol (V9 or IPFIX)
MissingTemplate
Data packet arrived for a template that isn’t in the cache.
This typically occurs when:
- Data packets arrive before their template definition (out-of-order)
- Template was evicted from cache before data arrived
- Template definition packet was lost in transit
Users can implement retry logic or buffering strategies based on this event.
Fields
protocol: TemplateProtocolThe protocol (V9 or IPFIX)
Trait Implementations§
Source§impl Clone for TemplateEvent
impl Clone for TemplateEvent
Source§fn clone(&self) -> TemplateEvent
fn clone(&self) -> TemplateEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more