[PEAK] Heads up: '_open()' signature to change soon
Phillip J. Eby
pje at telecommunity.com
Tue Mar 23 19:33:38 EST 2004
Hey all. If you're using any 'storage.ManagedConnection' subclasses, such
as custom SQL/LDAP/whatever connection types, you should be aware that the
'_open()' method signature is going to change in a4. Currently, the
'connection' binding calls '_open()' with no parameters, but in future this
will be '_open(address)', so you'll define the open method as:
and you'll need to use the passed-in address, as 'self.address' will no
longer be available.
This is in preparation for supporting automatic connection
failover. ManagedConnection will be changed to allow connecting to each of
several possible addresses if the preceding addresses failed. This will be
done by calling _open() with each address in turn until the operation succeeds.
You'll be able to specify multiple addresses using
'naming.Reference("connection.classname", ["addr1","addr2",...])', or the
corresponding 'ref:' URL syntax in a URL. Then, the managed connection
will be created with a collection of the addresses to be tried.
Note, by the way, that once this feature is added, it will automatically
provide simple failover capability to all managed connection types,
including SQL and LDAP connections, as well as any custom connection types
you've created for Jabber or Spread or whatever else.
Oh, and there will probably be a couple of other things you'll have to add
to your existing connection classes, like the protocol (class or interface)
your connection class expects its addresses to conform to, and an exception
class (or tuple thereof) that should be used to trigger failover, as
opposed to being treated as a program error. (Maybe there'll be a method
that gets called to validate a particular exception value as well; I
haven't finished fleshing out the design here just yet.)
More information about the PEAK