New gen_stream behaviour
Jay Nelson
jay@REDACTED
Mon May 17 11:25:09 CEST 2010
Bjorn,
I pushed a new behaviour to stdlib called gen_stream which implements
a process-striped buffer for reading files, binaries or generated
streams as a serial set of data blocks. This is a complete rewrite
of a submission I made at the end of 2007 (see http://www.duomark.com/
erlang/proposals/gen_stream.html for the original background on the
project).
I created a fairly thorough gen_stream_SUITE.erl and official
documentation in the gen_stream.xml file. It is stable enough to
use, although I need to add some more tests to the SUITE (timeout,
hibernate, ignore and stop on initialization, code_change, and an
example behaviour that uses dets handles which must be maintained in
the module state. I also need to debug issues I am having on a
single core laptop with too many processes (not sure if this is the
implementation or a problem with the external behaviour module
example I am testing with).
The API is slightly changed from the original; the API for the
behaviour is more different from the original. I added the ability
to pass a transform fun or mfa to reformat each data block as it is
written to internal buffers. This allows newline delimited text to
be split efficiently, and allows for any arbitrary transformation of
the data type or format but only independently within each block of
data.
Will this module require an EEP?
You can retrieve the new code from my account:
git fetch git://github.com/jaynel/otp.git gen_stream
jay
More information about the erlang-patches
mailing list