使用 Twisted 进行非阻塞文件访问 [英] Non-blocking file access with Twisted

查看:33
本文介绍了使用 Twisted 进行非阻塞文件访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚是否存在使用扭曲的文件访问的事实上的模式.我看过的很多例子(twisted.python.log、twisted.persisted.dirdbm、twisted.web.static)实际上似乎并不担心文件访问的阻塞.

I'm trying to figure out if there is a defacto pattern for file access using twisted. Lots of examples I've looked at (twisted.python.log, twisted.persisted.dirdbm, twisted.web.static) actually don't seem to worry about blocking for file access.

似乎应该有一些明显的接口,可能是从 abstract.FileDescriptor 继承的,所有文件访问都应该作为生产者/消费者通过它.

It seems like there should be some obvious interface, probably inheriting from abstract.FileDescriptor, that all file access should be going through it as a producer/consumer.

我是否遗漏了一些东西,或者只是在异步编程中,twisted 的主要用途是用于网络,而它并没有真正用于其他文件描述符操作,而不是担心非阻塞 IO 的纯度?

Have I missed something or is it just that the primary use for twisted in asynchronous programming is for networking and it hasn't really been worked out for other file descriptor operations, not worrying about the purity of non-blocking IO ?

推荐答案

我认为您正在寻找 fdesc 模块.有关 Python 中非阻塞 I/O 的更多信息,您还可以观看此 视频.

I think you are looking for the fdesc module. For more information on non-blocking I/O in Python, you can also watch this video.

这篇关于使用 Twisted 进行非阻塞文件访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆