[ZODB-Dev] Ordering before commit hooks

2005-08-05 Thread Julien Anguenot
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I would like to order the before commit hooks on a transaction by being
able to specify an order for a subscriber at registration time. For the
moment, they are called in the order they've been registred.

The order argument could be an integer with a default value to 0 added
to the registration method.

We could just insert the subscriber wihin the queue according to this
order parameter if found *or* sorting the queue according to this
parameter before flushing the queue and calling the hooks.

What do you think ?

J.

- --
Julien Anguenot | Nuxeo RD (Paris, France)
CPS Platform : http://www.cps-project.org
Zope3 / ECM   : http://www.z3lab.org
mail: anguenot at nuxeo.com; tel: +33 (0) 6 72 57 57 66
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFC8z2CGhoG8MxZ/pIRAu8sAJ4vHRVCMcNNQoRUVZaxQ6risIdzlgCcDhAl
EVYn/Ew0jXfhUn+d4WMdvhk=
=dkcf
-END PGP SIGNATURE-
___
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] Ordering before commit hooks

2005-08-05 Thread Gary Poster


On Aug 5, 2005, at 6:20 AM, Julien Anguenot wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I would like to order the before commit hooks on a transaction by  
being
able to specify an order for a subscriber at registration time. For  
the

moment, they are called in the order they've been registred.


I like this idea, and was just idly wishing for it this morning.


The order argument could be an integer with a default value to 0 added
to the registration method.


I usually like the word 'priority' for this sort of value, rather  
than 'order'.  To me 'order' implies unique value--i.e., with 'order'  
I am mildly surprised to learn that two entries may have  the same  
order.  I am not surprised that two entries may share a priority.


If negative values are acceptable then a default value of 0 is OK by me.


We could just insert the subscriber wihin the queue according to this
order parameter if found *or* sorting the queue according to this
parameter before flushing the queue and calling the hooks.


I think it would be ideal if before commit hooks with the same  
priority continue to be in the order in which they were added.  There  
are a number of ways to accomplish this and I expect you can choose a  
very reasonable one :-)


Gary
___
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] Ordering before commit hooks

2005-08-05 Thread Gary Poster


On Aug 5, 2005, at 2:33 PM, Tim Peters wrote:


[Julien Anguenot]
...

The order argument could be an integer with a default value to 0  
added

to the registration method.



[Gary Poster]

I usually like the word 'priority' for this sort of value, rather  
than

'order'.  To me 'order' implies unique value--i.e., with 'order' I am
mildly surprised to learn that two entries may have  the same  
order.  I

am not surprised that two entries may share a priority.



It's wholly unclear to me, given a callback with associated value 0  
and
another with associated value 999, which one is supposed to be  
invoked
first.  If the parameter is called priority, then I'd expect  
999 to

win; if it's called order, then 0.


To each his own, I suppose--'first priority' and 'last priority' is  
my model, in which, at the least, a priority of 1 would be first  
priority and a priority of 999 is a reasonable last priority  
(acknowledging a positive infinity as something that would take the  
honor of being reliably last priority, then).  A priority of 0, and a  
negative priority, start to muddle the model a bit, certainly.


But anyway, if you don't see 'priority' in that way, then yes, it is  
perhaps unclear in a different dimension than 'order' is unclear. :-)


Gary
___
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