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

Function ingest_source

src/sessions/source.rs:130–141  ·  view source on GitHub ↗

Drive a single source to completion against `db`, ingesting every transcript it locates for `project_root`. Fail-open: per-file errors are swallowed. `max_new_bytes` bounds how much newly-appended content a byte-offset source will read in one call (used to keep per-prompt hot paths inside budget); pass `None` for an unbounded catch-up.

(
    db: &GlobalDb,
    source: &dyn TranscriptSource,
    project_root: &Path,
    max_new_bytes: Option<u64>,
)

Source from the content-addressed store, hash-verified

128/// will read in one call (used to keep per-prompt hot paths inside budget);
129/// pass `None` for an unbounded catch-up.
130pub async fn ingest_source(
131 db: &GlobalDb,
132 source: &dyn TranscriptSource,
133 project_root: &Path,
134 max_new_bytes: Option<u64>,
135) -> TranscriptIngestStats {
136 let mut stats = TranscriptIngestStats::default();
137 for path in source.transcript_paths(project_root) {
138 stats = stats.merge(ingest_one(db, source, &path, project_root, max_new_bytes).await);
139 }
140 stats
141}
142
143/// Ingest one transcript file: load the prior cursor, parse new content, persist
144/// the advanced cursor, then upsert the session (merging preserved fields) and

Calls 3

ingest_oneFunction · 0.85
transcript_pathsMethod · 0.45
mergeMethod · 0.45

Tested by

no test coverage detected