My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

Friendly Flow is a multiplexing server framework for Python that allows you to write code without callbacks.

Multiplexing Servers

Multiplexing servers serve multiple clients at the same time from a single process. Advantage over a solution with multiple processes or lightweight processes are

  • Communication between processes is a non-issue, since there is only one process.
  • No unexpected process switches, no need for critical sections.
  • Smaller footprint.

Event Driven Servers...

At slow tasks like I/O, control is yielded to other client's handlers. The traditional way to yield control is "Event Driven". A heavy task is called in a deferred manner and the handler exits. A callback function is passed as and will be called when the task is done. However, having to split up your program along the lines of I/O is unnatural.

...Without Event Callbacks

Friendly Flow allows you to write code without callbacks, just like you would do for non-multiplexing servers. It then automagically splits your code out to an event driven program. The python keyword yield is used to determine where control is yielded back.

There is many types of yield:

  • CPU yield, returning when other handlers yield back to you
  • I/O yield, returning only when a resource is readable or writeable
  • "fork", yield a new "process"
  • decomposition, yield a "program" that has any number of yields of its own

Requirements

Friendly Flow requires Python >= 2.5.

Powered by Google Project Hosting