diff options
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/indexer/cache.py')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/indexer/cache.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/indexer/cache.py b/packages/meshbay-node/src/meshbay_node/indexer/cache.py index 5e328ef..afa4f85 100644 --- a/packages/meshbay-node/src/meshbay_node/indexer/cache.py +++ b/packages/meshbay-node/src/meshbay_node/indexer/cache.py @@ -112,17 +112,16 @@ class IndexCache: async def __aexit__(self, *_): await self.close() - async def lookup(self, path: str, size: int, mtime: float, - hash_version: int = 1) -> CachedEntry | None: + async def lookup(self, path: str, size: int, mtime: float) -> CachedEntry | None: """ - A cache hit requires an EXACT match on size, mtime AND hash_version. - A v1 cached hash won't serve a v2 lookup for the same path — the file - is re-hashed with the new algorithm instead. + A cache hit requires an EXACT match on size and mtime, and serves the + hash under whatever hash_version it was computed: a scheme change must + not change the id of a file the node already knows. """ async with self._db.execute( "SELECT hash, type, added_at, hash_version FROM files " - "WHERE path = ? AND size = ? AND mtime = ? AND hash_version = ?", - (path, size, mtime, hash_version)) as cur: + "WHERE path = ? AND size = ? AND mtime = ?", + (path, size, mtime)) as cur: row = await cur.fetchone() return CachedEntry(hash=row[0], type=row[1], added_at=row[2], hash_version=row[3]) if row else None |