MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / spawn_consumer

Function spawn_consumer

nodedb/src/event/consumer.rs:105–119  ·  view source on GitHub ↗

Spawn a consumer Tokio task for one Data Plane core's event ring buffer.

(config: ConsumerConfig)

Source from the content-addressed store, hash-verified

103
104/// Spawn a consumer Tokio task for one Data Plane core's event ring buffer.
105pub 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.
122async fn consumer_loop(config: ConsumerConfig, metrics: Arc<CoreMetrics>) {

Callers 2

spawnMethod · 0.85

Calls 3

consumer_loopFunction · 0.85
spawnFunction · 0.50
core_idMethod · 0.45

Tested by

no test coverage detected