Is safe to use the shove module to store data in a non blocking program?
I'm writing a simple crawler with eventlet and I want to store all the url I re开发者_开发技巧trieve in a simple datastore like shove. Is safe to use it in a non blocking enviroment?
Since most modules are written in the traditional synchronous/blocking module, unless your module explicitly touts that it is asynchronous, you need to handle it with a callback in your eventlet program. The shove home page doesn't mention anything about the issue, which means its probably going to block on file I/O. You might want to ask the shove development community if there's an async variant.
It depends whether you are OK with blocking disk I/O. A lot of people accept the blocking aspect of disk I/O even in asynchronous programs, as they regard it as 'fast enough'. If not, you'll have to move the data store handling to another thread or worker threads.
Or figure out if your O/S can do non-blocking disk I/O from a single thread and port your database library to that. But that's likely a lot of extra work.
精彩评论