Skip to main content

insert_timeline_event

Function insert_timeline_event 

Source
pub fn insert_timeline_event(
    conn: &mut Connection,
    event_id: &str,
    room_id: &str,
    sender_user_id: i64,
    event_type: &str,
    content: &str,
    origin_server_ts: i64,
) -> Result<MatrixEvent, MatrixStoreError>
Expand description

Insert one timeline event (state_key always NULL) inside its own transaction: mint the next stream id, insert the row, and — if content carries a top-level m.relates_to (cleartext even for m.room.encrypted, plan §10 item 3) — populate [relations]. Refusing a duplicate m.annotation rolls back the whole transaction, so a refused call leaves no partial events row. It never records a txn_id: a write that carries one goes through insert_timeline_event_deduped, which stores it next to its dedup record in the same transaction.