| 1317 | } |
| 1318 | |
| 1319 | pub async fn upsert_store_instance( |
| 1320 | &self, |
| 1321 | upsert: StoreInstanceUpsert, |
| 1322 | ) -> Option<StoreInstanceRecord> { |
| 1323 | let now = crate::tracedecay::current_timestamp(); |
| 1324 | self.conn |
| 1325 | .execute( |
| 1326 | "INSERT INTO store_instances |
| 1327 | (store_id, project_id, store_kind, storage_mode, store_relpath, |
| 1328 | manifest_relpath, created_at, last_verified_at, last_write_at) |
| 1329 | VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9) |
| 1330 | ON CONFLICT(store_id) DO UPDATE SET |
| 1331 | project_id = excluded.project_id, |
| 1332 | store_kind = excluded.store_kind, |
| 1333 | storage_mode = excluded.storage_mode, |
| 1334 | store_relpath = excluded.store_relpath, |
| 1335 | manifest_relpath = excluded.manifest_relpath, |
| 1336 | last_verified_at = excluded.last_verified_at, |
| 1337 | last_write_at = excluded.last_write_at", |
| 1338 | params![ |
| 1339 | upsert.store_id.as_str(), |
| 1340 | upsert.project_id.as_str(), |
| 1341 | upsert.store_kind.as_str(), |
| 1342 | upsert.storage_mode.as_str(), |
| 1343 | upsert.store_relpath.as_str(), |
| 1344 | opt_text(upsert.manifest_relpath.as_deref()), |
| 1345 | now, |
| 1346 | opt_i64(upsert.last_verified_at), |
| 1347 | opt_i64(upsert.last_write_at), |
| 1348 | ], |
| 1349 | ) |
| 1350 | .await |
| 1351 | .ok()?; |
| 1352 | self.get_store_instance(&upsert.store_id).await |
| 1353 | } |
| 1354 | |
| 1355 | pub async fn upsert_graph_scope(&self, upsert: GraphScopeUpsert) -> Option<GraphScopeRecord> { |
| 1356 | self.conn |