Previously, we could get empty intervals anyway by having a non-empty
interval and removing a smaller interval around each piece of data.
Turns out that empty intervals are OK and needed in some situations,
so explicitly allow and test for it.
Now supports these operations:
ctx.insert_line()
ctx.insert_iter()
ctx.finalize() (end the current contiguous interval, so a new one
can be started with a gap)
ctx.update_end() (update ending timestamp before finalizing interval)
ctx.update_start() (update starting timestamp for new interval)
block_data += "string" is fast with local variables, but slow with
variables inside some namespace. Instead, build a list of strings and
join them once at the end. This fixes the slowdown that resulted from
the stream_insert_context cleanup.
It still should be closed, but warning each time was mostly for
debugging and it's kind of annoying when writing one-off programs
where it's OK to just let things get torn down as they're completed.
Not closing is not fatal in terms of data integrity etc.
Extending and then writing to the mmap file has a problem: if the disk
fills up, the mapping becomes invalid, and the Python interpreter will
get a SIGBUS, killing it. It's difficult to catch this gracefully;
there's no way to do that with existing modules. Instead, switch to
only using mmap when reading, and normal file writes when writing.
Since we only ever append, it should have similar performance.
Specifically, switch from using global configuration and several apps,
to using application-specific configuration with a single app. This
should hopefully make it easier to plug this into another
WSGI-compliant server someday, and also silences some startup warnings
about missing application configs.
Now we build Cython modules only if cython >= 0.16 is present.
Tarballs made by "make sdist" include the Cython-generated *.c files,
and so Cython isn't required on the end user machine at all.