Project

rack-chain

0.0
No commit activity in last 3 years
No release in over 3 years
Rack::Chain builds a Rack application that runs each middleware in its own fiber to minimize stack depth.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.8.0

Runtime

>= 1.4.0
 Project Readme

Rack::Chain

Rack::Chain uses fibers to minimize stack depth in Rack applications.

A Rack application assembled with Rack::Chain runs each middleware #call in a separate fiber, thereby avoiding deep stacks.

The name "chain" comes from javax.servlet.FilterChain, which is the equivalent pattern to Rack middleware in the Java Servlet API.

Until the Rack API morphs into a before/after pattern which would allow decomposing the request pipeline into a flat sequence of function applications over a request and a response, these kinds of cheeky gyrations may be necessary.

Requirements

Because Rack::Chain relies on fibers for its operation, Ruby 1.9 is required.

Usage

To use Rack::Chain with existing Rack applications, place the following lines in your config.ru:

require 'rack/chain'
extend Rack::Chain::Linker