pub struct WorkerPool {
pub batch_size: usize,
pub timeout_ms: u64,
/* private fields */
}Expand description
Worker pool for parallel HTTP packet processing.
Fields§
§batch_size: usize§timeout_ms: u64Implementations§
Source§impl WorkerPool
impl WorkerPool
Sourcepub fn new(
num_workers: usize,
queue_size: usize,
batch_size: usize,
timeout_ms: u64,
result_sender: Sender<HttpAnalysisResult>,
matcher: Option<SharedHttpMatcher>,
max_connections: usize,
filter_config: Option<FilterConfig>,
) -> Result<Arc<Self>, HuginnNetHttpError>
pub fn new( num_workers: usize, queue_size: usize, batch_size: usize, timeout_ms: u64, result_sender: Sender<HttpAnalysisResult>, matcher: Option<SharedHttpMatcher>, max_connections: usize, filter_config: Option<FilterConfig>, ) -> Result<Arc<Self>, HuginnNetHttpError>
Creates a new worker pool for HTTP analysis.
§Parameters
num_workers: Number of worker threadsqueue_size: Size of each worker’s packet queuebatch_size: Maximum packets to process in one batchtimeout_ms: Worker receive timeout in millisecondsresult_sender: Channel to send analysis resultsmatcher: Optional shared signature matchermax_connections: Maximum HTTP flows to track per workerfilter_config: Optional filter configuration for packet filtering
§Returns
A new WorkerPool or an error if creation fails.
Sourcepub fn worker_index_for_packet(&self, packet: &[u8]) -> usize
pub fn worker_index_for_packet(&self, packet: &[u8]) -> usize
Deterministically computes which worker would process packet based
on its flow hash. Useful for tests that want to assert routing
decisions without going through the actual queue.
pub fn dispatch(&self, packet: Vec<u8>) -> DispatchResult
pub fn stats(&self) -> PoolStats
Auto Trait Implementations§
impl !Freeze for WorkerPool
impl RefUnwindSafe for WorkerPool
impl Send for WorkerPool
impl Sync for WorkerPool
impl Unpin for WorkerPool
impl UnsafeUnpin for WorkerPool
impl UnwindSafe for WorkerPool
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
Mutably borrows from an owned value. Read more