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

Method upsert

src/global_db.rs:1864–1875  ·  view source on GitHub ↗

Registers or updates a project's tokens-saved count. Best-effort.

(&self, project_path: &Path, tokens_saved: u64)

Source from the content-addressed store, hash-verified

1862
1863 /// Registers or updates a project's tokens-saved count. Best-effort.
1864 pub async fn upsert(&self, project_path: &Path, tokens_saved: u64) {
1865 let path_str = Self::canonical_project_key(project_path);
1866 let _ = self
1867 .conn
1868 .execute(
1869 "INSERT INTO projects (path, tokens_saved) VALUES (?1, ?2)
1870 ON CONFLICT(path) DO UPDATE SET
1871 tokens_saved = MAX(tokens_saved, excluded.tokens_saved)",
1872 params![path_str, tokens_saved as i64],
1873 )
1874 .await;
1875 }
1876
1877 /// Returns the stored `tokens_saved` count for a specific project, or 0 if not found.
1878 pub async fn get_project_tokens(&self, project_path: &Path) -> u64 {

Calls

no outgoing calls