Re: [ZODB-Dev] Undo alternatives

2009-12-28 Thread Marius Gedminas
On Thu, Dec 24, 2009 at 09:37:22AM -0500, Jim Fulton wrote:
 As I mentioned in another message, undo is staying, but, as many also
 mentioned in that thread, undo often doesn't work due to conflicts. I
 thought I'd mention some alternatives:
 
 - Time travel
 
   ZODB has a number of facilities for time travel:
 
   - Object history
 
 There's an API for looking at changes over time. For simple
 objects, recovering from a misshap can often be as simple as
 copying state from an old revision. Zope 2 has (or had) a built
 in view for this.

And zodbbrowser allows you to do this for Zope 3.

Marius Gedminas
-- 
System going down at 5 this afternoon to install scheduler bug.


signature.asc
Description: Digital signature
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev


[ZODB-Dev] Undo alternatives

2009-12-24 Thread Jim Fulton
As I mentioned in another message, undo is staying, but, as many also
mentioned in that thread, undo often doesn't work due to conflicts. I
thought I'd mention some alternatives:

- Time travel

  ZODB has a number of facilities for time travel:

  - Object history

There's an API for looking at changes over time. For simple
objects, recovering from a misshap can often be as simple as
copying state from an old revision. Zope 2 has (or had) a built
in view for this.

  - Time traveling database connections

In ZODB 3.9, the database open method grew a optional 'at' and
'before' keyword arguments to open a connection with a view of the
database as of a particular point in time.

  - zc.beforestorage

This is a storage wrapper that provides a read-only unchanging
view of a database as of a particular time.  (We use it with
DemoStorage for staging new releases with customer data without
having to copy customer databases.)

- Truncation

  Although there isn't an API, truncating a file-storage database as
  of a particular time is pretty easy:

   import ZODB.FileStorage, ZODB.TimeStamp
   tid = repr(ZODB.TimeStamp.TimeStamp(y, m, d, h, min, s))
   it = ZODB.FileStorage.FileIterator(path, tid)
   f = open(path, 'r+b')
   f.seek(it._pos)
   f.truncate()

  This is certainly easier and more precise than restoring from a
  backup.

  Maybe FileStorage should get an API for this.  I'm working on a
  storage implementation based on Berkeley DB and it has a truncate
  function, mainly because truncation isn't so easy for this
  implementation and I need it for some benchmarking I'm doing.

Jim

--
Jim Fulton
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev