def _loadBlobInternal(self, cursor, oid, serial, blob_lock=None): blob_filename = self._cachedLoadBlobInternal(oid, serial) if not blob_filename: # All the blobs are in a shared directory. If the file # isn't here, it's not anywhere. raise POSKeyError(oid, serial=serial, blob_filename=blob_filename) return blob_filename
def __pke(self, oid_bytes, **extra): defs = { 'cache': self.cache, 'load': self.load_connection, 'adapter': self.adapter, } defs.update(extra) return POSKeyError(oid_bytes, defs)
def _loadBlobLocked(self, cursor, oid, serial, blob_filename): """ Returns a filename that exists on disk, or raises a POSKeyError. """ # OK, it's not here and we (or someone) needs to get it. We # want to avoid getting it multiple times. We want to avoid # getting it multiple times even accross separate client # processes on the same machine. We'll use file locking. # (accomplished by our caller.) # We got the lock, so it's our job to download it. First, # we'll double check that someone didn't download it while # we were getting the lock: if os.path.exists(blob_filename): return self._accessed(blob_filename) self.download_blob(cursor, oid, serial, blob_filename) if os.path.exists(blob_filename): return self._accessed(blob_filename) __traceback_info__ = cursor raise POSKeyError(oid, serial=serial, fn=blob_filename)