1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! [`NetworkSource`]: the batch-poll trait for network backends.
//!
//! Every network backend (AF_XDP, DPDK, simulator, pcap replay) implements
//! this trait. The pipeline drives it by calling [`poll_batch`] in a loop
//! and forwarding each [`RawBatch`] to the decoder stage.
//!
//! ## Relationship to [`crate::core::Source`]
//!
//! [`crate::core::Source`] returns one byte slice per poll. `NetworkSource`
//! extends the model with a batch API, which is essential for network
//! ingest where polling in bursts amortises system-call overhead.
//!
//! A future pipeline revision will drive `NetworkSource` directly.
//! For now, backends also implement `crate::core::Source` as a compatibility
//! shim (returning the first packet of each batch).
//!
//! [`poll_batch`]: NetworkSource::poll_batch
use crate;
use crateRawBatch;
/// What the source should do when the downstream pipeline cannot keep up.
///
/// The default policy for new backends is [`DropNewest`][Self::DropNewest].
/// Production deployments must choose a policy explicitly and configure
/// their metrics to surface drop events — FlyBy never silently drops.
/// A network packet source that produces raw bytes in batches.
///
/// All network backends — simulated, AF_XDP, DPDK, pcap replay — implement
/// this trait. The pipeline calls [`poll_batch`][Self::poll_batch] in a
/// tight loop. Back-pressure is reported via [`backpressure_policy`][Self::backpressure_policy]
/// and tracked via [`RawBatch::record_drop`].