• Barry Warsaw's avatar
    "Experimental" support for undoing past an object's creation. This · c9fab9ff
    Barry Warsaw authored
    works by writing a metadata record which contains a special lrevid
    (pickle pointer).  Upon loading a zombified object, naive applications
    will get a KeyError as would be expected for loading a non-existant
    object.
    
    The actual exception though is ObjectDoesNotExist -- derived from
    KeyError -- which contains a `revid' attribute pointing to the
    revision of the object which zombified it.  Thus, by undoing this
    revid, the object can be reborn to its initial state.
    
    Specifically,
    
    ObjectDoesNotExist: New exception, derived from KeyError.
    
    load(): If an object's metadata has an lrevid with the special `dne'
    value (64-bits full of 1's), the object is a zombie and
    ObjectDoesNotExist is raised.
    
    transactionalUndo(): If prevrevid for the revision we're undoing is
    zero, it means that we're undoing the object's creation.  Instead of
    raising an UndoError, write a new metadata record containing the
    original record, but with lrevid == dne, and prevrevid == tid.
    
    This change also contains initial (untested) support for pack(),
    specifically,
    
    _zaprevision(): pack doesn't happen in a transaction, so remove the
    txn argument.  Add the referencesf argument, passed from the pack()
    call.
    
    pack(): Initial implementation.  Seems fairly simple really (too
    simple? ;)
    c9fab9ff
BDBFullStorage.py 42.4 KB