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

Function detect_sequence_gap

nodedb/src/event/consumer_helpers.rs:27–44  ·  view source on GitHub ↗

Detect sequence gaps (events dropped by the producer due to buffer overflow).

(
    core_id: usize,
    event: &WriteEvent,
    last_sequence: u64,
    metrics: &CoreMetrics,
)

Source from the content-addressed store, hash-verified

25
26/// Detect sequence gaps (events dropped by the producer due to buffer overflow).
27pub fn detect_sequence_gap(
28 core_id: usize,
29 event: &WriteEvent,
30 last_sequence: u64,
31 metrics: &CoreMetrics,
32) {
33 if last_sequence > 0 && event.sequence > last_sequence + 1 {
34 let gap = event.sequence - last_sequence - 1;
35 metrics.record_drop(gap);
36 warn!(
37 core_id,
38 gap,
39 last_seq = last_sequence,
40 new_seq = event.sequence,
41 "event sequence gap — {gap} events dropped (WAL replay needed)"
42 );
43 }
44}
45
46/// Process a single event. Dispatch point for trigger matching, CDC, etc.
47pub fn record_event(core_id: usize, event: &WriteEvent, metrics: &CoreMetrics) {

Callers 2

drain_ring_bufferFunction · 0.85
gap_detectionFunction · 0.85

Calls 1

record_dropMethod · 0.45

Tested by 1

gap_detectionFunction · 0.68