Il giorno 29/set/2011, alle ore 18:06, Valentin V. Bartenev ha scritto:

> On Thursday 29 September 2011 19:24:13 Roberto De Ioris wrote:
>> do not worry uWSGi does not make any assumption about the passed vars, you
>> can even pass
>> 
>> {'foo':'bar'}
>> 
>> to it and it will be happy.
>> 
>> uwsgi.send_message("addr:port", 0, 0, {'foo':'bar'})
>> 
>> this will translate to a string of 14 byte sent to the socket.
> 
> Oh, now I see, thanks!
> 
> I prefer to use uwsgi.rpc call for such task, but looks like, that uWSGI RPC 
> stack haven't got async interface like "async_send_message".
> 

I will commit an async_rpc function soon.

In the mean time i have re-thinked th aio_read api:

fd = open('myhugefile.txt')
data = uwsgi.wait_aio_read(fd.fileno(), 40000[,offset])
uwsgi.suspend()
print data
fd.close()

This is more compliant to the current scheme.
'data' will be preallocated based on the size of the second argument.

when returning from suspend(), 'data' contains the data (a string/bytes object 
of 40000
bytes)

I will probably only need to add a way to check for errors after suspend(), 
then it will be usable.

What do you think about it ?

--
Roberto De Ioris
http://unbit.it
JID: [email protected]

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to