Re: Async branch documentation and review

Federico Di Gregorio <fog-NGVKUo/i/[email protected]> Thu, 08 Apr 2010 18:50:27 +0200
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 08/04/2010 14:33, Daniele Varrazzo wrote:
> Hello,
> 
> I've written documentation for the new Psycopg async support. Together
> with other patches it is available in the "fix22" branch of my git
> repos:

All changes have been integrated. Thank you very much.

> Do we really need cursor.poll()? There can only be a single async
> cursor in execution per connection. On the other side we can't do
> without connection.poll() because is using during connection, when
> there is no cursor. What about dropping cursor.poll() and only leave
> connection.poll()? If an app only had a reference to the cursor it
> would always be possible to call curs.connection.poll().

You're right but having .poll() on the cursor has a certain simmetry
with fileno():

	if select([curs], None, None):
	    if not curs.poll():
	        ....

Note that select() is smart and you don't even need to specify .poll()
explicitly. But if most of psycopg users think than simpler is better I
can teach myself to like

	if select([curs], None, None):
	    if not curs.connection.poll():
	        ....

but then wouldn't it be better to also remove fileno() and move
everything connection-related on the connection? we must decide now,
before the release because I'd like to not change the API once an
official release is out.

> Do we really need cursor.fileno()? This is stronger than the above,
> because while conceptually in the cursor there may be state that the
> connection doesn't know about (not in the current implementation, but
> there may be), there is honestly a single fd, and it belongs to the
> connection.

Ops... I started writing the email before reaching this point. :)
Ok, two votes for removal.

I'll read the rest and comment later.

federico

-- 
Federico Di Gregorio                                       fog-NGVKUo/i/[email protected]
  Qu'est ce que la folie? Juste un sentiment de liberté si
   fort qu'on en oublie ce qui nous rattache au monde... -- J. de Loctra

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAku+CVMACgkQvcCgrgZGjetA9gCgpSfogQz8ztGyTVfmwlvpDgrE
SZsAoJaiUijZkLzJRwatph+OYnJVSy2z
=RF4A
-----END PGP SIGNATURE-----