Skip to main content

Module stream_ingester

Module stream_ingester 

Source
Expand description

스트리밍 수집 파이프라인 — CDC 스타일 INSERT/UPDATE/DELETE 이벤트 처리

§개요

StreamIngester는 채널 기반의 스트리밍 수집 파이프라인을 제공합니다. Kafka, Kinesis 등 메시지 스트림에서 수신하는 CDC 이벤트(INSERT/UPDATE/DELETE)를 StreamEvent enum으로 표현하여 background 스레드가 DBX에 일괄 반영합니다.

§사용 예

use dbx_core::{Database, engine::stream_ingester::{StreamIngester, StreamEvent}};
use std::{sync::Arc, time::Duration};

let db = Arc::new(Database::open_in_memory().unwrap());
let ingester = StreamIngester::new(Arc::clone(&db), "orders", 1000, Duration::from_millis(100));
let tx = ingester.sender();

tx.send(vec![
    StreamEvent::Insert { key: "order:1".into(), value: b"[1, \"pending\"]".to_vec() },
    StreamEvent::Update { key: "order:2".into(), value: b"[2, \"shipped\"]".to_vec() },
    StreamEvent::Delete { key: "order:3".into() },
]).unwrap();

ingester.flush().unwrap();

Structs§

StreamIngester
채널 기반 스트리밍 수집 파이프라인

Enums§

StreamEvent
스트림 이벤트 — INSERT / UPDATE / DELETE를 통합 표현