bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def tpc_begin(self, transaction, tid=None, status=' '): if self._is_read_only: raise POSException.ReadOnlyError() self._lock_acquire() try: if self._transaction is transaction: return self._lock_release() self._commit_lock_acquire() self._lock_acquire() self._transaction = transaction self._clear_temp() | def tpc_begin(self, transaction, tid=None, status=' '): if self._is_read_only: raise POSException.ReadOnlyError() self._lock_acquire() try: if self._transaction is transaction: return self._lock_release() self._commit_lock_acquire() self._lock_acquire() self._transaction = transaction self._clear_temp() | 27,300 |
def tpc_begin(self, transaction, tid=None, status=' '): if self._is_read_only: raise POSException.ReadOnlyError() self._lock_acquire() try: if self._transaction is transaction: return self._lock_release() self._commit_lock_acquire() self._lock_acquire() self._transaction = transaction self._clear_temp() | def tpc_begin(self, transaction, tid=None, status=' '): if self._is_read_only: raise POSException.ReadOnlyError() self._lock_acquire() try: if self._transaction is transaction: return self._lock_release() self._commit_lock_acquire() self._lock_acquire() self._transaction = transaction self._clear_temp() | 27,301 |
def testExceptionInTpcAbort(self): | deftestExceptionInTpcAbort(self): | 27,302 |
def testExceptionInTpcAbort(self): | def testExceptionInTpcAbort(self): | 27,303 |
def _dostore(self, oid=None, revid=None, data=None, version=None, already_pickled=0): """Do a complete storage transaction. The defaults are: - oid=None, ask the storage for a new oid - revid=None, use a revid of ZERO - data=None, pickle up some arbitrary data (the integer 7) - version=None, use the empty string vers... | def _dostore(self, oid=None, revid=None, data=None, version=None, already_pickled=0, user=None, description=None): """Do a complete storage transaction. The defaults are: - oid=None, ask the storage for a new oid - revid=None, use a revid of ZERO - data=None, pickle up some arbitrary data (the integer 7) - version=No... | 27,304 |
def read_txn_header(f, pos, file_size, outp, ltid): # Read the transaction record f.seek(pos) h = f.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl = u64(stl) if pos + (tl + 8) > file_size: error("bad transaction length at %s", pos) if tl < (23 + ... | def read_txn_header(f, pos, file_size, outp, ltid): # Read the transaction record f.seek(pos) h = f.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl = u64(stl) if pos + (tl + 8) > file_size: error("bad transaction length at %s", pos) if tl < (23 + ... | 27,305 |
def main(): try: opts, (inp, outp) = getopt.getopt(sys.argv[1:], "fv:pP:") except getopt.error: die() print __doc__ % argv[0] force = partial = verbose = 0 pack = None for opt, v in opts: if opt == "-v": verbose = int(v) elif opt == "-p": partial = 1 elif opt == "-f": force = 1 elif opt == "-P": pack = time.time() - f... | def main(): try: opts, (inp, outp) = getopt.getopt(sys.argv[1:], "fv:pP:") except getopt.error: die() print __doc__ % sys.argv[0] force = partial = verbose = 0 pack = None for opt, v in opts: if opt == "-v": verbose = int(v) elif opt == "-p": partial = 1 elif opt == "-f": force = 1 elif opt == "-P": pack = time.time()... | 27,306 |
def commit(self, txn): # commit calls _finishCommit() or abort() assert txn._status is Status.ACTIVE txn._status = Status.PREPARING prepare_ok = True self.logger.debug("%s: prepare", txn) try: for r in txn._resources: if prepare_ok and not r.prepare(txn): prepare_ok = False except: txn._status = Status.FAILED raise txn... | def commit(self, txn): # commit calls _finishCommit() or abort() assert txn._status is Status.ACTIVE txn._status = Status.PREPARING prepare_ok = True self.logger.debug("%s: prepare", txn) try: for r in txn._resources: if prepare_ok and not r.prepare(txn): raise AbortError(r) except: txn._status = Status.FAILED raise tx... | 27,307 |
def commit(self, txn): # commit calls _finishCommit() or abort() assert txn._status is Status.ACTIVE txn._status = Status.PREPARING prepare_ok = True self.logger.debug("%s: prepare", txn) try: for r in txn._resources: if prepare_ok and not r.prepare(txn): prepare_ok = False except: txn._status = Status.FAILED raise txn... | def commit(self, txn): # commit calls _finishCommit() or abort() assert txn._status is Status.ACTIVE txn._status = Status.PREPARING prepare_ok = True self.logger.debug("%s: prepare", txn) try: for r in txn._resources: if prepare_ok and not r.prepare(txn): prepare_ok = False except: txn._status = Status.FAILED raise txn... | 27,308 |
def savepoint(self, txn): self.logger.debug("%s: savepoint", txn) return Rollback([r.savepoint(txn) for r in txn._resources]) | def savepoint(self, txn): self.logger.debug("%s: savepoint", txn) return Rollback([r.savepoint(txn) for r in txn._resources]) | 27,309 |
def savepoint(self, txn): self.logger.debug("%s: savepoint", txn) return Rollback([r.savepoint(txn) for r in txn._resources]) | def savepoint(self, txn): self.logger.debug("%s: savepoint", txn) return Rollback([r.savepoint(txn) for r in txn._resources]) | 27,310 |
def begin(self): txn = self.txn_factory(self) self.logger.debug("%s: begin", txn) return txn | def begin(self): txn = self.txn_factory(self) self.logger.debug("%s: begin", txn) return txn | 27,311 |
def abort(self, txn): super(TransactionManager, self).abort(txn) self._current = None | defdef suspend(self, txn): if self._current != txn: raise TransactionError("Can't suspend transaction because " "it is not active") self._suspended.add(txn) self._current = None abort(self,def suspend(self, txn): if self._current != txn: raise TransactionError("Can't suspend transaction because " "it is not active") se... | 27,312 |
def __init__(self, resources): self._resources = resources | def __init__(self, txn, resources): self._txn = txn self._resources = resources | 27,313 |
def suspend(self, txn): tid = thread.get_ident() if self._pool[tid] is txn: self._suspend.add(txn) del self._pool[tid] else: raise TransactionError("txn %s not owned by thread %s" % (txn, tid)) | def suspend(self, txn): tid = thread.get_ident() if self._pool.get(tid) is txn: self._suspend.add(txn) del self._pool[tid] else: raise TransactionError("txn %s not owned by thread %s" % (txn, tid)) | 27,314 |
def checkSize(self, size): # Make sure we aren't going to exceed the target size. # If we are, then flip the cache. if self._pos+size > self._limit: current=not self._current self._current=current if self._p[current] is not None: # Persistent cache file: # Note that due to permission madness, waaa, # we need to remove ... | def checkSize(self, size): # Make sure we aren't going to exceed the target size. # If we are, then flip the cache. if self._pos+size > self._limit: current=not self._current self._current=current if self._p[current] is not None: # Persistent cache file: # Note that due to permission madness, waaa, # we need to remove ... | 27,315 |
def transactionalUndo(self, transaction_id, transaction): """Undo a transaction, given by transaction_id. | def transactionalUndo(self, transaction_id, transaction): """Undo a transaction, given by transaction_id. | 27,316 |
def transactionalUndo(self, transaction_id, transaction): """Undo a transaction, given by transaction_id. | defwhile 1: self._file.seek(pos) h = self._file.read(DATA_HDR_LEN) doid,serial,prev,tpos,vlen,plen = unpack('>8s8s8s8sH8s', h) tpos = U64(tpos) self._file.seek(tpos) thistid = self._file.read(8) if thistid == tid: break pos = U64(prev) if not pos: raise UndoError, 'Invalid undo transaction id' transactionalUndo(se... | 27,317 |
def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | 27,318 |
def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt = self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.u... | 27,319 |
def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.un... | 27,320 |
def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | 27,321 |
def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | 27,322 |
def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | 27,323 |
def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | 27,324 |
def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | defundoLog(self,first=0,last=-20,filter=None):iflast<0:last=first-last+1self._lock_acquire()try:packt=self._packtifpacktisNone:raiseUndoError('Undoiscurrentlydisabledfordatabasemaintenance.<p>')pos=self._posifpos<39:return[]file=self._fileseek=file.seekread=file.readunpack=struct.unpackstrip=string.stripencode=base64.e... | 27,325 |
def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | def undoLog(self, first=0, last=-20, filter=None): if last < 0: last=first-last+1 self._lock_acquire() try: packt=self._packt if packt is None: raise UndoError( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unp... | 27,326 |
def setklassstate(self, object, tt=type(()), ct=type(HelperClass)): oid=object._p_oid __traceback_info__=oid p, serial = self._storage.load(oid, self._version) file=StringIO(p) unpickler=Unpickler(file) unpickler.persistent_load=self._persistent_load | def setklassstate(self, object, tt=type(()), ct=type(HelperClass)): oid=object._p_oid __traceback_info__=oid p, serial = self._storage.load(oid, self._version) file=StringIO(p) unpickler=Unpickler(file) unpickler.persistent_load=self._persistent_load | 27,327 |
def find_global(modulename, classname): """Helper for this test suite to get special PersistentMapping""" print modulename, classname if classname == "PersistentMapping": class PersistentMapping: def __setstate__(self, state): self.__dict__.update(state) return PersistentMapping else: __import__(modulename) mod = sys.... | def find_global(modulename, classname): """Helper for this test suite to get special PersistentMapping""" if classname == "PersistentMapping": class PersistentMapping: def __setstate__(self, state): self.__dict__.update(state) return PersistentMapping else: __import__(modulename) mod = sys.modules[modulename] return ... | 27,328 |
def log(message, level=zLOG.INFO, label="StorageServer:%s" % os.getpid(), error=None): zLOG.LOG(label, level, message, error=error) | _label = "ZSS" def set_label(): global _label _label = "ZSS:%s" % os.getpid() def log(message, level=zLOG.INFO, label=None, error=None): zLOG.LOG(label or _label, level, message, error=error) | 27,329 |
def _log(self, msg, level=zLOG.INFO, error=None, pid=os.getpid()): name = getattr(self.__storage, '__name__', None) if name is None: name = str(self.__storage) zLOG.LOG("ZEOStorage:%s:%s" % (pid, name), level, msg, error=error) | def _log(self, msg, level=zLOG.INFO, error=None): name = getattr(self.__storage, '__name__', None) if name is None: name = str(self.__storage) zLOG.LOG("ZEOStorage:%s:%s" % (pid, name), level, msg, error=error) | 27,330 |
def _log(self, msg, level=zLOG.INFO, error=None, pid=os.getpid()): name = getattr(self.__storage, '__name__', None) if name is None: name = str(self.__storage) zLOG.LOG("ZEOStorage:%s:%s" % (pid, name), level, msg, error=error) | def _log(self, msg, level=zLOG.INFO, error=None, pid=os.getpid()): name = getattr(self.__storage, '__name__', None) if name is None: name = str(self.__storage) zLOG.LOG("ZEOStorage:%s:%s" % (pid, name), level, msg, error=error) | 27,331 |
def new_oids(self, n=100): """Return a sequence of n new oids, where n defaults to 100""" if n <= 0: # Always return at least one n = 1 return [self.__storage.new_oid() for i in range(n)] | defnew_oids(self,n=100):"""Returnasequenceofnnewoids,wherendefaultsto100"""ifn<=0:#Alwaysreturnatleastonen=1return[self.__storage.new_oid()foriinrange(n)] | 27,332 |
def tearDown(self): """Try to cause the tests to halt""" zLOG.LOG("testZEO", zLOG.INFO, "tearDown() %s" % self.id()) for p in self.conf_paths: os.remove(p) if getattr(self, '_storage', None) is not None: self._storage.close() if hasattr(self._storage, 'cleanup'): self._storage.cleanup() for adminaddr in self._servers: ... | def tearDown(self): """Try to cause the tests to halt""" zLOG.LOG("testZEO", zLOG.INFO, "tearDown() %s" % self.id()) for p in self.conf_paths: os.remove(p) if getattr(self, '_storage', None) is not None: self._storage.close() if hasattr(self._storage, 'cleanup'): self._storage.cleanup() for adminaddr in self._servers: ... | 27,333 |
def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | 27,334 |
def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | 27,335 |
def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for ... | 27,336 |
def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | 27,337 |
def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | 27,338 |
def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | 27,339 |
def rotate_logs(): import zLOG # There hasn't been a clear way to reinitialize the MinimalLogger. # I'll checkin the public initialize() method soon, but also try some # other strategies for older Zope installs :-(. init = getattr(zLOG, 'initialize', None) if init is not None: init() return # This will work if the mini... | def rotate_logs(): import zLOG # There hasn't been a clear way to reinitialize the MinimalLogger. # I'll checkin the public initialize() method soon, but also try some # other strategies for older Zope installs :-(. init = getattr(zLOG, 'initialize', None) if init is not None: init() return # This will work if the mini... | 27,340 |
def set_uid(arg): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO/start.py', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: arg = int(arg) except: # conversion could rai... | def set_uid(arg): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO/start.py', INFO, ("Can't set uid to %s." "pwd module is not available." % arg)) return try: gid = None try: arg = int(arg) except: # conversion could rai... | 27,341 |
def __init__(self, sock, addr, map=None, debug=None): self.addr = addr if debug is not None: self._debug = debug elif not hasattr(self, '_debug'): self._debug = __debug__ # __input_lock protects __inp, __input_len, __state, __msg_size self.__input_lock = threading.Lock() self.__inp = None # None, a single String, or a ... | def __init__(self, sock, addr, map=None, debug=None): self.addr = addr if debug is not None: self._debug = debug elif not hasattr(self, '_debug'): self._debug = __debug__ # __input_lock protects __inp, __input_len, __state, __msg_size self.__input_lock = threading.Lock() self.__inp = None # None, a single String, or a ... | 27,342 |
def main(argv): me=argv[0] sys.path[:]==filter(None, sys.path) sys.path.insert(0, directory(me, 2)) args=[] last='' for a in argv[1:]: if (a[:1] != '-' and string.find(a, '=') > 0 and last != '-S' # lame, sorry ): a=string.split(a,'=') os.environ[a[0]]=string.join(a[1:],'=') continue args.append(a) last=a INSTANCE_HO... | def main(argv): me=argv[0] sys.path[:]==filter(None, sys.path) sys.path.insert(0, directory(me, 2)) args=[] last='' for a in argv[1:]: if (a[:1] != '-' and string.find(a, '=') > 0 and last != '-S' # lame, sorry ): a=string.split(a,'=') os.environ[a[0]]=string.join(a[1:],'=') continue args.append(a) last=a INSTANCE_HO... | 27,343 |
def info(RESPONSE): RESPONSE['Content-type']= 'text/plain' | def info(RESPONSE): RESPONSE['Content-type']= 'text/plain' | 27,344 |
def info(RESPONSE): RESPONSE['Content-type']= 'text/plain' | def info(RESPONSE): RESPONSE['Content-type']= 'text/plain' | 27,345 |
def __init__(self, name='Demo Storage', base=None, quota=None): | def __init__(self, name='Demo Storage', base=None, quota=None): | 27,346 |
def commitVersion(self, src, dest, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: v=self._vindex.get(src, None) if v is None: return tindex=self._tindex oids=[] for r in v.values(): oid, serial, pre, vdata, p = r oids.appe... | def commitVersion(self, src, dest, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: v=self._vindex.get(src, None) if v is None: return tindex=self._tindex oids=[] for r in v.values(): oid, serial, pre, vdata, p = r oids.appe... | 27,347 |
def load(self, oid, version): self._lock_acquire() try: try: oid, serial, pre, vdata, p = self._index[oid] except: if self._base: return self._base.load(oid, '') raise KeyError, oid | def load(self, oid, version): self._lock_acquire() try: try: oid, serial, pre, vdata, p = self._index[oid] except KeyError: if self._base: return self._base.load(oid, '') raise KeyError, oid | 27,348 |
def load(self, oid, version): self._lock_acquire() try: try: oid, serial, pre, vdata, p = self._index[oid] except: if self._base: return self._base.load(oid, '') raise KeyError, oid | def load(self, oid, version): self._lock_acquire() try: try: oid, serial, pre, vdata, p = self._index[oid] except: if self._base: return self._base.load(oid, '') raise KeyError, oid | 27,349 |
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | 27,350 |
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | 27,351 |
def versions(self, max=None): r=[] a=r.append for version in self._vindex.keys()[:max]: if self.versionEmpty(version): continue a(version) if max and len(r) >= max: return r | def versions(self, max=None): r=[] a=r.append for version in self._vindex.keys()[:max]: if self.versionEmpty(version): continue a(version) if max and len(r) >= max: return r | 27,352 |
def commit(self, object, transaction): if object is self: # We registered ourself. Execute a commit action, if any. if self.__onCommitActions is not None: method_name, args, kw = self.__onCommitActions.pop(0) apply(getattr(self, method_name), (transaction,) + args, kw) return oid = object._p_oid invalid = self._invali... | def commit(self, object, transaction): if object is self: # We registered ourself. Execute a commit action, if any. if self.__onCommitActions is not None: method_name, args, kw = self.__onCommitActions.pop(0) apply(getattr(self, method_name), (transaction,) + args, kw) return oid = object._p_oid invalid = self._invali... | 27,353 |
# def persistent_id(object, | # def persistent_id(object, | 27,354 |
def setstate(self, object): oid = object._p_oid | def setstate(self, object): oid = object._p_oid | 27,355 |
def tpc_begin(self, transaction, sub=None): if self._invalid(None): # Some nitwit invalidated everything! raise ConflictError("transaction already invalidated") self._invalidating = [] self._creating = [] | def tpc_begin(self, transaction, sub=None): if self._invalid(None): # Some nitwit invalidated everything! raise ConflictError("transaction already invalidated") self._invalidating = [] self._creating = [] | 27,356 |
def main(path): fs = FileStorage(path, read_only=1) noload = {} for oid in fs._index.keys(): try: data, serial = fs.load(oid, "") except: print "oid %s failed to load" % hex(u64(oid)) if VERBOSE: traceback.print_exc() noload[oid] = 1 # XXX If we get here after we've already loaded objects # that refer to this one, we ... | def main(path): fs = FileStorage(path, read_only=1) noload = {} for oid in fs._index.keys(): try: data, serial = fs.load(oid, "") except: print "oid %s failed to load" % hex(u64(oid)) if VERBOSE: traceback.print_exc() noload[oid] = 1 # XXX If we get here after we've already loaded objects # that refer to this one, we ... | 27,357 |
def message_input(self, message): """Decoding an incoming message and dispatch it""" # XXX Not sure what to do with errors that reach this level. # Need to catch ZRPCErrors in handle_reply() and # handle_request() so that they get back to the client. try: msgid, flags, name, args = self.marshal.decode(message) except D... | def message_input(self, message): """Decoding an incoming message and dispatch it""" # XXX Not sure what to do with errors that reach this level. # Need to catch ZRPCErrors in handle_reply() and # handle_request() so that they get back to the client. try: msgid, flags, name, args = self.marshal.decode(message) except D... | 27,358 |
def send_call(self, method, args, flags): # send a message and return its msgid self.__msgid_lock.acquire() try: msgid = self.msgid self.msgid = self.msgid + 1 finally: self.__msgid_lock.release() if __debug__: log("send msg: %d, %d, %s, ..." % (msgid, flags, method)) buf = self.marshal.encode(msgid, flags, method, arg... | def send_call(self, method, args, flags): # send a message and return its msgid self.__msgid_lock.acquire() try: msgid = self.msgid self.msgid = self.msgid + 1 finally: self.__msgid_lock.release() if __debug__: log("send msg: %d, %d, %s, ..." % (msgid, flags, method), zLOG.TRACE) buf = self.marshal.encode(msgid, flags,... | 27,359 |
def undoLog(self, first, last, filter=None): self._lock_acquire() try: packt=self._packt if packt is None: raise POSException.UndoError, ( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unpack strip=string.strip... | def undoLog(self, first, last, filter=None): self._lock_acquire() try: packt=self._packt if packt is None: raise POSException.UndoError, ( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unpack strip=string.strip... | 27,360 |
def check_periodic_save_index(self): | def check_periodic_save_index(self): | 27,361 |
def tearDown(self): try: os.remove(self.path) except os.error: pass if os.environ.has_key('STUPID_LOG_FILE'): del os.environ['STUPID_LOG_FILE'] if os.environ.has_key('EVENT_LOG_FILE'): del os.environ['EVENT_LOG_FILE'] if os.environ.has_key('STUPID_LOG_SEVERITY'): del os.environ['STUPID_LOG_SEVERITY'] if os.environ.has_... | def tearDown(self): try: os.remove(self.path) except os.error: pass if os.environ.has_key('STUPID_LOG_FILE'): del os.environ['STUPID_LOG_FILE'] if os.environ.has_key('EVENT_LOG_FILE'): del os.environ['EVENT_LOG_FILE'] if os.environ.has_key('STUPID_LOG_SEVERITY'): del os.environ['STUPID_LOG_SEVERITY'] if os.environ.has_... | 27,362 |
def __init__(self, file_name, create=0, read_only=0, stop=None, quota=None): | def __init__(self, file_name, create=0, read_only=0, stop=None, quota=None): | 27,363 |
def _sane(self, index, pos): """Sanity check saved index data by reading the last undone trans | def _sane(self, index, pos): """Sanity check saved index data by reading the last undone trans | 27,364 |
def _sane(self, index, pos): """Sanity check saved index data by reading the last undone trans | def _sane(self, index, pos): """Sanity check saved index data by reading the last undone trans | 27,365 |
def _sane(self, index, pos): """Sanity check saved index data by reading the last undone trans | def _sane(self, index, pos): """Sanity check saved index data by reading the last undone trans | 27,366 |
def _sane(self, index, pos): """Sanity check saved index data by reading the last undone trans | def _sane(self, index, pos): """Sanity check saved index data by reading the last undone trans | 27,367 |
def _restore_index(self): """Load the database index from a file to support quick startup """ file_name=self.__name__ index_name=file_name+'.index' try: f=open(index_name,'rb') except: return None p=Unpickler(f) | def _restore_index(self): """Load the database index from a file to support quick startup """ file_name=self.__name__ index_name=file_name+'.index' try: f=open(index_name,'rb') except: return None p=Unpickler(f) | 27,368 |
def close(self): self._file.close() self._lock_file.close() self._tfile.close() self._save_index() | def close(self): self._file.close() self._lock_file.close() self._tfile.close() try: self._save_index() except: pass | 27,369 |
def commitVersion(self, src, dest, transaction, abort=None): # We are going to commit by simply storing back pointers. | def commitVersion(self, src, dest, transaction, abort=None): # We are going to commit by simply storing back pointers. | 27,370 |
def commitVersion(self, src, dest, transaction, abort=None): # We are going to commit by simply storing back pointers. | def commitVersion(self, src, dest, transaction, abort=None): # We are going to commit by simply storing back pointers. | 27,371 |
def commitVersion(self, src, dest, transaction, abort=None): # We are going to commit by simply storing back pointers. | def commitVersion(self, src, dest, transaction, abort=None): # We are going to commit by simply storing back pointers. | 27,372 |
def _loada(self, oid, _index, file): "Read any version and return the version" pos=_index[oid] file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if vlen: nv = read(8) != z64 file.seek(8,1) # Skip previous version record pointer version=read(vlen) else: version='' nv=0 | def _loada(self, oid, _index, file): "Read any version and return the version" pos=_index[oid] file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if vlen: nv = read(8) != z64 file.seek(8,1) # Skip previous version record pointer version=read(vlen) else: version='' nv=0 | 27,373 |
def _load(self, oid, version, _index, file): pos=_index[oid] file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if doid != oid: raise CorruptedDataError, h if vlen: pnv=read(8) # Read location of non-version data if (not version or len(version) != vlen or (read(8) # ski... | def _load(self, oid, version, _index, file): pos=_index[oid] file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if doid != oid: raise CorruptedDataError, h if vlen: pnv=read(8) # Read location of non-version data if (not version or len(version) != vlen or (read(8) # ski... | 27,374 |
def loadSerial(self, oid, serial): self._lock_acquire() try: _index=self._index file=self._file seek=file.seek read=file.read pos=_index[oid] while 1: seek(pos) h=read(42) doid,dserial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if doid != oid: raise CorruptedDataError, h if dserial == serial: break # Yeee ha! # Ke... | def loadSerial(self, oid, serial): self._lock_acquire() try: _index=self._index file=self._file seek=file.seek read=file.read pos=_index[oid] while 1: seek(pos) h=read(42) doid,dserial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if doid != oid: raise CorruptedDataError, h if dserial == serial: break # Yeee ha! # Ke... | 27,375 |
def loadSerial(self, oid, serial): self._lock_acquire() try: _index=self._index file=self._file seek=file.seek read=file.read pos=_index[oid] while 1: seek(pos) h=read(42) doid,dserial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if doid != oid: raise CorruptedDataError, h if dserial == serial: break # Yeee ha! # Ke... | def loadSerial(self, oid, serial): self._lock_acquire() try: _index=self._index file=self._file seek=file.seek read=file.read pos=_index[oid] while 1: seek(pos) h=read(42) doid,dserial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if doid != oid: raise CorruptedDataError, h if dserial == serial: break # Yeee ha! # Ke... | 27,376 |
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | 27,377 |
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) | 27,378 |
def _begin(self, tid, u, d, e): self._thl=23+len(u)+len(d)+len(e) | defself._nextpos=0 def tpc_vote(self, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: tfile=self._tfile dlen=tfile.tell() if not dlen: return file=self._file write=file.write tfile.seek(0) id=self._serial user, desc, ext = ... | 27,379 |
def _finish(self, tid, u, d, e): tfile=self._tfile dlen=tfile.tell() if not dlen: return # No data in this trans file=self._file write=file.write tfile.seek(0) id=self._serial user, desc, ext = self._ude | def _finish(self, tid, u, d, e): # No data in this trans file=self._file write=file.write tfile.seek(0) id=self._serial user, desc, ext = self._ude | 27,380 |
def _finish(self, tid, u, d, e): tfile=self._tfile dlen=tfile.tell() if not dlen: return # No data in this trans file=self._file write=file.write tfile.seek(0) id=self._serial user, desc, ext = self._ude | def _finish(self, tid, u, d, e): tfile=self._tfile dlen=tfile.tell() if not dlen: return # No data in this trans file=self._file write=file.write tfile.seek(0) id=self._serial user, desc, ext = self._ude | 27,381 |
def undo(self, transaction_id): self._lock_acquire() try: self._clear_index() transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) packt=self._packt if packt is None or packt > tid: raise POSException.UndoError, ( 'Undo is currently disabled for database main... | def undo(self, transaction_id): self._lock_acquire() try: self._clear_index() transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], U64(transaction_id[8:]) packt=self._packt if packt is None or packt > tid: raise POSException.UndoError, ( 'Undo is currently disabled for database main... | 27,382 |
def undo(self, transaction_id): self._lock_acquire() try: self._clear_index() transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) packt=self._packt if packt is None or packt > tid: raise POSException.UndoError, ( 'Undo is currently disabled for database main... | def undo(self, transaction_id): self._lock_acquire() try: self._clear_index() transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) packt=self._packt if packt is None or packt > tid: raise POSException.UndoError, ( 'Undo is currently disabled for database main... | 27,383 |
def undo(self, transaction_id): self._lock_acquire() try: self._clear_index() transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) packt=self._packt if packt is None or packt > tid: raise POSException.UndoError, ( 'Undo is currently disabled for database main... | def undo(self, transaction_id): self._lock_acquire() try: self._clear_index() transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) packt=self._packt if packt is None or packt > tid: raise POSException.UndoError, ( 'Undo is currently disabled for database main... | 27,384 |
def undo(self, transaction_id): self._lock_acquire() try: self._clear_index() transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) packt=self._packt if packt is None or packt > tid: raise POSException.UndoError, ( 'Undo is currently disabled for database main... | def undo(self, transaction_id): self._lock_acquire() try: self._clear_index() transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) packt=self._packt if packt is None or packt > tid: raise POSException.UndoError, ( 'Undo is currently disabled for database main... | 27,385 |
def undo(self, transaction_id): self._lock_acquire() try: self._clear_index() transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) packt=self._packt if packt is None or packt > tid: raise POSException.UndoError, ( 'Undo is currently disabled for database main... | def undo(self, transaction_id): self._lock_acquire() try: self._clear_index() transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) packt=self._packt if packt is None or packt > tid: raise POSException.UndoError, ( 'Undo is currently disabled for database main... | 27,386 |
def undoLog(self, first, last, filter=None): self._lock_acquire() try: packt=self._packt if packt is None: raise POSException.UndoError, ( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unpack strip=string.strip... | def undoLog(self, first, last, filter=None): self._lock_acquire() try: packt=self._packt if packt is None: raise POSException.UndoError, ( 'Undo is currently disabled for database maintenance.<p>') pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unpack strip=string.strip... | 27,387 |
def versionEmpty(self, version): self._lock_acquire() try: index=self._index file=self._file seek=file.seek read=file.read srcpos=self._vindex_get(version, 0) t=tstatus=None while srcpos: seek(srcpos) oid=read(8) if index[oid]==srcpos: return 0 h=read(50) # serial, prev(oid), tloc, vlen, plen, pnv, pv tloc=h[16:24] if ... | def versionEmpty(self, version): self._lock_acquire() try: index=self._index file=self._file seek=file.seek read=file.read srcpos=self._vindex_get(version, 0) t=tstatus=None while srcpos: seek(srcpos) oid=read(8) if index[oid]==srcpos: return 0 h=read(50) # serial, prev(oid), tloc, vlen, plen, pnv, pv tloc=h[16:24] if ... | 27,388 |
def versionEmpty(self, version): self._lock_acquire() try: index=self._index file=self._file seek=file.seek read=file.read srcpos=self._vindex_get(version, 0) t=tstatus=None while srcpos: seek(srcpos) oid=read(8) if index[oid]==srcpos: return 0 h=read(50) # serial, prev(oid), tloc, vlen, plen, pnv, pv tloc=h[16:24] if ... | def versionEmpty(self, version): self._lock_acquire() try: index=self._index file=self._file seek=file.seek read=file.read srcpos=self._vindex_get(version, 0) t=tstatus=None while srcpos: seek(srcpos) oid=read(8) if index[oid]==srcpos: return 0 h=read(50) # serial, prev(oid), tloc, vlen, plen, pnv, pv tloc=h[16:24] if ... | 27,389 |
def history(self, oid, version=None, length=1, filter=None): self._lock_acquire() try: r=[] file=self._file seek=file.seek read=file.read pos=self._index[oid] wantver=version | def history(self, oid, version=None, length=1, filter=None): self._lock_acquire() try: r=[] file=self._file seek=file.seek read=file.read pos=self._index[oid] wantver=version | 27,390 |
def history(self, oid, version=None, length=1, filter=None): self._lock_acquire() try: r=[] file=self._file seek=file.seek read=file.read pos=self._index[oid] wantver=version | def history(self, oid, version=None, length=1, filter=None): self._lock_acquire() try: r=[] file=self._file seek=file.seek read=file.read pos=self._index[oid] wantver=version | 27,391 |
def history(self, oid, version=None, length=1, filter=None): self._lock_acquire() try: r=[] file=self._file seek=file.seek read=file.read pos=self._index[oid] wantver=version | def history(self, oid, version=None, length=1, filter=None): self._lock_acquire() try: r=[] file=self._file seek=file.seek read=file.read pos=self._index[oid] wantver=version | 27,392 |
def history(self, oid, version=None, length=1, filter=None): self._lock_acquire() try: r=[] file=self._file seek=file.seek read=file.read pos=self._index[oid] wantver=version | def history(self, oid, version=None, length=1, filter=None): self._lock_acquire() try: r=[] file=self._file seek=file.seek read=file.read pos=self._index[oid] wantver=version | 27,393 |
def _redundant_pack(self, file, pos): file.seek(pos-8) p=u64(file.read(8)) file.seek(pos-p+8) return file.read(1) not in ' u' | def _redundant_pack(self, file, pos): file.seek(pos-8) p=U64(file.read(8)) file.seek(pos-p+8) return file.read(1) not in ' u' | 27,394 |
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc... | def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc... | 27,395 |
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc... | def pack(self, t, referencesf): """Copy data from the current database file to a packed fileNon-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records.Also, data back pointers that point before packtss are resolved and the associated data are copied, since th... | 27,396 |
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc... | def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc... | 27,397 |
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc... | def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc... | 27,398 |
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc... | def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc... | 27,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.