• Jim Fulton's avatar
    Refactored FileStorage transactional undo · d717a685
    Jim Fulton authored
    As part of a project to provide object-level commit locks for ZEO, I'm
    refactiring FileStorage to maintain transaction-specific data in
    Tranaction.data.  This involved undo.  In trying to figure this out, I
    found:
    
    - A bug in _undoDataInfo, which I verified with some tests and
    
    - _transactionalUndoRecord was maddeningly difficult to reason about
      (and thus change).
    
    I was concerned less by the bug than my inability to know whether a
    change to the code would be correct.
    
    So I refactored the code, mainly transactionalUndoRecord, to make the
    code easier to understand, fixing some logic errors (I'm pretty sure)
    along the way.  This included lots of comments. (Comments are much
    easier to compose when you're working out logic you didn't
    understand.)
    
    In addition to makeing the code cleaner, it allows undo to be handled
    in cases that weren't handled before.
    d717a685
TransactionalUndoStorage.py 28.9 KB