def touch(self, digest, size): # Verify an actual file is valid. Note that is doesn't compute the hash so # it could still be corrupted. Do it outside the lock. if not isolateserver.is_valid_file(self._path(digest), size): return False # Update it's LRU position. with self._lock: if digest not in self._lru: return False self._lru.touch(digest) return True
def touch(self, digest, size): """Verifies an actual file is valid. Note that is doesn't compute the hash so it could still be corrupted if the file size didn't change. TODO(maruel): More stringent verification while keeping the check fast. """ # Do the check outside the lock. if not isolateserver.is_valid_file(self._path(digest), size): return False # Update it's LRU position. with self._lock: if digest not in self._lru: return False self._lru.touch(digest) return True