Class: Pipeline
Defined in: | src/kermit/Pipeline.coffee |
Overview
The pipeline is a convenience abstraction that allows to attach writable streams as destinations for the data of the http(s).IncomingMessage. Destinations are attached in combination with a selector that defines which types of responses are to be piped into the stream. The most common scenario is stream attachment based on response content-type.
Examples:
stream ContentType( [/.*html(.*)/g] ), process.stdout
Instance Method Summary
- # (void) stream(guard, stream) Attach a stream as (one of multiple) destination(s).
- # (void) import(incomingMessage) Import the meta data from the incoming message and attach all mapped streams (with matching guards) to the response stream.
- # (void) cleanup() Delete all references to objects that may occupy large amount of memory
- # (void) target()
Constructor Details
#
(void)
constructor(log, item)
Create a new Pipeline for the given RequestItem
Instance Method Details
#
(void)
stream(guard, stream)
Attach a stream as (one of multiple) destination(s). The stream is guarded by a function that defines whether or not the stream will receive the response data from the incoming message. Any stream that has a matching guard function will receive the data from the incoming message. Error handlers will be added to the stream and the item will be transitioned to phase ERROR if any streaming error occurs.
#
(void)
import(incomingMessage)
Import the meta data from the incoming message and attach all mapped streams (with matching guards) to the response stream.
#
(void)
cleanup()
Delete all references to objects that may occupy large amount of memory
#
(void)
target()