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

Method get_parse_offset

src/global_db.rs:3865–3900  ·  view source on GitHub ↗

Returns the saved parse cursor for a JSONL file, including the optional file identity id, or `None` if the path is not tracked.

(&self, path: &str)

Source from the content-addressed store, hash-verified

3863 /// Returns the saved parse cursor for a JSONL file, including the
3864 /// optional file identity id, or `None` if the path is not tracked.
3865 pub async fn get_parse_offset(&self, path: &str) -> Option<ParseOffset> {
3866 let Ok(mut rows) = self
3867 .conn
3868 .query(
3869 "SELECT byte_offset, mtime, file_id FROM parse_offsets WHERE file_path = ?1",
3870 params![path],
3871 )
3872 .await
3873 else {
3874 let mut rows = self
3875 .conn
3876 .query(
3877 "SELECT byte_offset, mtime FROM parse_offsets WHERE file_path = ?1",
3878 params![path],
3879 )
3880 .await
3881 .ok()?;
3882 let row = rows.next().await.ok()??;
3883 let offset: i64 = row.get(0).ok()?;
3884 let mtime: i64 = row.get(1).ok()?;
3885 return Some(ParseOffset {
3886 byte_offset: offset as u64,
3887 mtime: mtime as u64,
3888 file_id: 0,
3889 });
3890 };
3891 let row = rows.next().await.ok()??;
3892 let offset: i64 = row.get(0).ok()?;
3893 let mtime: i64 = row.get(1).ok()?;
3894 let file_id: i64 = row.get(2).ok()?;
3895 Some(ParseOffset {
3896 byte_offset: offset as u64,
3897 mtime: mtime as u64,
3898 file_id: file_id as u64,
3899 })
3900 }
3901
3902 /// Saves the parse cursor for a transcript path. Best-effort.
3903 pub async fn set_parse_offset(&self, path: &str, offset: ParseOffset) {

Callers 7

import_sourceFunction · 0.80
session_ingest_healthMethod · 0.80
ingest_oneFunction · 0.80
ingest_state_dbFunction · 0.80
ingestFunction · 0.80
parse_offset_for_pathFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected