MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / upsert_transcript_batch

Method upsert_transcript_batch

src/global_db.rs:2627–2645  ·  view source on GitHub ↗

Atomically upserts one transcript session + all parsed messages and then advances the parse cursor. Any failure rolls back the entire batch so a follow-up ingest can safely replay from the previous offset.

(
        &self,
        session: &SessionRecord,
        messages: &[SessionMessageRecord],
        parse_offset_path: &str,
        parse_offset: ParseOffset,
    )

Source from the content-addressed store, hash-verified

2625 /// advances the parse cursor. Any failure rolls back the entire batch so a
2626 /// follow-up ingest can safely replay from the previous offset.
2627 pub async fn upsert_transcript_batch(
2628 &self,
2629 session: &SessionRecord,
2630 messages: &[SessionMessageRecord],
2631 parse_offset_path: &str,
2632 parse_offset: ParseOffset,
2633 ) -> bool {
2634 let batch = TranscriptBatch {
2635 session: session.clone(),
2636 messages: messages.to_vec(),
2637 };
2638 self.upsert_transcript_batches_inner(
2639 std::slice::from_ref(&batch),
2640 parse_offset_path,
2641 parse_offset,
2642 TranscriptWriteMode::Full,
2643 )
2644 .await
2645 }
2646
2647 /// Atomically upserts several transcript sessions (and their messages),
2648 /// writing only the searchable `session_messages` projection — never

Callers 1

ingest_oneFunction · 0.80

Calls 1

Tested by

no test coverage detected