pub struct ConversationTable { /* private fields */ }Expand description
Thread-safe conversation tracking table backed by DashMap.
Supports concurrent packet ingestion from multiple threads while maintaining per-conversation state including TCP state machines and stream reassembly. Optionally tracks memory usage and spills reassembly buffers to disk when a budget is exceeded.
Implementations§
Source§impl ConversationTable
impl ConversationTable
Sourcepub fn new(config: FlowConfig) -> Self
pub fn new(config: FlowConfig) -> Self
Create a new table with the given configuration.
Sourcepub fn with_default_config() -> Self
pub fn with_default_config() -> Self
Create a new table with default configuration.
Sourcepub fn conversation_count(&self) -> usize
pub fn conversation_count(&self) -> usize
Number of tracked conversations.
Sourcepub fn ingest_packet(
&self,
packet: &Packet,
timestamp: Duration,
packet_index: usize,
) -> Result<(), FlowError>
pub fn ingest_packet( &self, packet: &Packet, timestamp: Duration, packet_index: usize, ) -> Result<(), FlowError>
Ingest a single parsed packet, updating or creating conversation state.
timestamp is the packet capture timestamp (from PCAP metadata).
packet_index is the index of this packet in the original capture
(used for cross-referencing).
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Estimated memory usage of the flow table (tracked reassembly buffers).
Sourcepub fn spill_count(&self) -> usize
pub fn spill_count(&self) -> usize
Number of spill operations performed.
Sourcepub fn get_conversation(
&self,
key: &CanonicalKey,
) -> Option<Ref<'_, CanonicalKey, ConversationState>>
pub fn get_conversation( &self, key: &CanonicalKey, ) -> Option<Ref<'_, CanonicalKey, ConversationState>>
Get a read reference to a specific conversation.
Sourcepub fn evict_idle(&self, now: Duration) -> usize
pub fn evict_idle(&self, now: Duration) -> usize
Evict conversations that have exceeded their idle timeout.
Returns the number of evicted conversations.
Sourcepub fn into_conversations(self) -> Vec<ConversationState>
pub fn into_conversations(self) -> Vec<ConversationState>
Consume the table and return all conversations sorted by start time.
Sourcepub fn config(&self) -> &FlowConfig
pub fn config(&self) -> &FlowConfig
Get a reference to the configuration.
Auto Trait Implementations§
impl !Freeze for ConversationTable
impl !RefUnwindSafe for ConversationTable
impl Send for ConversationTable
impl Sync for ConversationTable
impl Unpin for ConversationTable
impl UnsafeUnpin for ConversationTable
impl UnwindSafe for ConversationTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more