Spawn a consumer Tokio task for one Data Plane core's event ring buffer.
(config: ConsumerConfig)
| 103 | |
| 104 | /// Spawn a consumer Tokio task for one Data Plane core's event ring buffer. |
| 105 | pub fn spawn_consumer(config: ConsumerConfig) -> ConsumerHandle { |
| 106 | let core_id = config.rx.core_id(); |
| 107 | let metrics = Arc::new(CoreMetrics::new()); |
| 108 | let metrics_clone = Arc::clone(&metrics); |
| 109 | |
| 110 | let join_handle = tokio::spawn(async move { |
| 111 | consumer_loop(config, metrics_clone).await; |
| 112 | }); |
| 113 | |
| 114 | ConsumerHandle { |
| 115 | core_id, |
| 116 | metrics, |
| 117 | join_handle, |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | /// The main consumer loop. |
| 122 | async fn consumer_loop(config: ConsumerConfig, metrics: Arc<CoreMetrics>) { |
no test coverage detected