RE: [ZODB-Dev] Question about BTree transaction data

2006-04-14 Thread Pascal Peregrina
Excellent! This is exactly what I needed.

For reference, I attach your code and I hope it will get referenced by search 
engines :).

Attached History.py is an enhancement of OFS.History that enables read access 
to old revisions of an object, even if that object has persistent subobjects. 
Author: Dieter Maurer

Thanks a lot.

Pascal

-Message d'origine-
De : Dieter Maurer [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 13 avril 2006 21:56
À : Pascal Peregrina
Cc : zodb-dev@zope.org
Objet : RE: [ZODB-Dev] Question about BTree transaction data

Pascal Peregrina wrote at 2006-4-13 11:26 +0100:
So, if I use HistoryJar to load a BTree from a given old state, are you sure 
HistoryJar will correctly load all the BTree subobjects (sub BTrees and 
Buckets)? I got the impression, reading HistoryJar code, that it might load 
current state of subobjects, not old states... :(

The HistoryJar I spoke of is an improvement over
the one you find in OFS.History.

My HistoryJar binds persistent subobjects to itself. This way,
not only the main object is loaded with the state at a given
time but all its subobjects (and subsubobjects, etc.) as well.
It works not only for atomic objects (those without persistent subobjects)
but with arbitrary object hierarchies.

All you need for this to work is to ensure that persistent subobjects
are not associated with the original (the current time) connection
but remain associated with the HistoryJar.


I posted my HistoryJar implementation. Please, search the archives...

It will require modifications to work for ZODB 3.4 or higher,
as connection handling drastically changed between ZODB 3.2
and ZODB 3.4 -- but it will not be difficult to extends for
these ZODB versions (once you know, that the essential thing
is to preserve the connection for persistent subobjects)...


-- 
Dieter


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**



History.py
Description: History.py
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

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


Re: [ZODB-Dev] Question about BTree transaction data

2006-04-13 Thread Chris Withers

Dieter Maurer wrote:

Pascal Peregrina wrote at 2006-4-12 08:35 +0100:

I use FileStorage (via ZEO).

I have switched a big dictionary from PersistentMapping to BTree.

In the past, it was easy to compute added/deleted keys from states (cause 
PersistentMapping state contains the whole dictionary, so it was only a matter 
of getting the keys and comparing them with previous state keys).


What do you mean by state?
What you get with obj.__getstate__()?


I'd hazard a guess that Pascal is trying to write conflict resolution 
code. BTrees already have conflict resolution code. I'm not sure it can 
be improved upon.


cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

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

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


RE: [ZODB-Dev] Question about BTree transaction data

2006-04-13 Thread Pascal Peregrina
Replied to quickly...

So, if I use HistoryJar to load a BTree from a given old state, are you sure 
HistoryJar will correctly load all the BTree subobjects (sub BTrees and 
Buckets)? I got the impression, reading HistoryJar code, that it might load 
current state of subobjects, not old states... :(

Pascal

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Pascal Peregrina
Envoyé : jeudi 13 avril 2006 11:27
À : Dieter Maurer
Cc : zodb-dev@zope.org
Objet : RE: [ZODB-Dev] Question about BTree transaction data

HistoryJar is what I was looking for !!
Thanks !

Pascal

-Message d'origine-
De : Dieter Maurer [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 12 avril 2006 19:41
À : Pascal Peregrina
Cc : zodb-dev@zope.org
Objet : RE: [ZODB-Dev] Question about BTree transaction data

Pascal Peregrina wrote at 2006-4-12 08:35 +0100:
I use FileStorage (via ZEO).

I have switched a big dictionary from PersistentMapping to BTree.

In the past, it was easy to compute added/deleted keys from states (cause 
PersistentMapping state contains the whole dictionary, so it was only a matter 
of getting the keys and comparing them with previous state keys).

What do you mean by state?
What you get with obj.__getstate__()?

  In this case, you can indeed not compute added/deleted keys
  alone from the current and a previous state of the tree alone.
  You must also take into account the state of children...

...
So could you give me a little more details about what you mean? (or of course 
point me to some example/resources on the net)

Search the mailing list archive (for zope@zope.org or
zope-dev@zope.org) for a post from me about HistoryJar.

This is a speciallized ZODB connection that loads the state of objects
as it was at a given time.
In this, I do not mean state technically as the result of __getstate__
but as the complete object state. You can use such a historical
object in the same way as you use a current object (apart from
not being able to modify it). Especially, you can ask a historical
BTrees.XXBTree instance for
all its keys and compare this to all the keys of the current object.

-- 
Dieter


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**

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

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

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


RE: [ZODB-Dev] Question about BTree transaction data

2006-04-12 Thread Pascal Peregrina
I use FileStorage (via ZEO).

I have switched a big dictionary from PersistentMapping to BTree.

In the past, it was easy to compute added/deleted keys from states (cause 
PersistentMapping state contains the whole dictionary, so it was only a matter 
of getting the keys and comparing them with previous state keys).

I can't see how to do so with BTree states, which look much more complicated... 
So could you give me a little more details about what you mean? (or of course 
point me to some example/resources on the net)

Thanks.

Pascal

-Message d'origine-
De : Dieter Maurer [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 11 avril 2006 21:57
À : Pascal Peregrina
Cc : zodb-dev@zope.org
Objet : Re: [ZODB-Dev] Question about BTree transaction data

Pascal Peregrina wrote at 2006-4-10 09:04 +0100:
I would like to know if from BTree state data, it is possible to compute
which keys were added/deleted.

Of course not from a single state: it just tells you about the
current keys, not about their history.

If you are using a storage with history (e.g. FileStorage),
then the history can allow you to retrieve earlier states.
Comparing the current and some earlier state allows you to
determine additions/deletions (to some extend).

-- 
Dieter


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**

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

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