Opened 10 years ago

Last modified 6 years ago

#3983 enhancement new

asynchronous, non-blocking file I/O

Reported by: Glyph Owned by:
Priority: low Milestone:
Component: core Keywords:
Cc: Jason, yac, James Broadhead, Tobias Oberstein Branch:


Twisted should have an official API for (at least notionally) non-blocking filesystem input and output.

This may not be possible without cheating a little bit, because asynchronous file I/O support is not really there in most operating systems. However, we could:

  1. do the file I/O in a subprocess
  2. do the file I/O in a thread (one thread per mount point? a threadpool?)
  3. just block, with timers, but present an API which would be amenable to non-blocking later. (Possibly, this strategy is already partially satisfied by twisted.protocols.basic.FileSender.)
  4. some combination of these, with a back-end that could be selected somehow

Something that FileSender does not satisfy is some equivalent to 'tail -f'; allowing a Twisted program to easily and non-blockingly monitor the log or file output of another program as if it were coming from a socket. This is somewhat tricky to do in the general case, since it's hard to detect when the log or file is done being written. Still there are heuristics (wait until this process has died, wait until this other file has disappeared) which could provide a useful substitute for certainty of connectionLost.

(I will be surprised if this is not a duplicate of something, but searches yield nothing.)

Change History (6)

comment:1 Changed 10 years ago by Jean-Paul Calderone

You may have been thinking of Specification/AsynchronousFileInputOutput.

comment:2 Changed 8 years ago by <automation>

Owner: Glyph deleted

comment:3 Changed 8 years ago by Jason

Cc: Jason added

comment:4 Changed 7 years ago by yac

Cc: yac added

comment:5 Changed 6 years ago by James Broadhead

Cc: James Broadhead added

comment:6 Changed 6 years ago by Tobias Oberstein

Cc: Tobias Oberstein added
Note: See TracTickets for help on using tickets.