apache/incubator-flink — pull request #77 by aljoscha (2014-07-22 12:16:07+00:00)
Title: [FLINK-987] Add seeking to DataOutputView

This addresses the output side of FLINK-987. Output views operate
directly on memory segments and provide an interface akin to a random
access buffer (with some restrictions, such as required
locking/unlocking).

Introduce lock(), unlock(), tell(), and seek(long) methods in
DataOutputView interface and all child classes. Users of the interface
(for example Serializers) must take care to manually reset the writing
position to the end of the data. Data left after the writing positions
might be discarded or overwritten.

Refactor AbstractPagedOutputView into superclass
AbstractMemorySegmentOutputView of which AbstractPagedOutputView is now
a child. AbstractMemorySegmentOutputView is for output views that don't
need locking because they always have all the segments available.
AbstractPagedOutputView is for those output views that always want to
flush segments away but use locking to temporarilly keep them ( for
tell() and seek(long)).

Method nextSegment() of AbstractPagedOutputView refactored into
returnSegment() and requestSegment() since we sometimes must return
several segments at once while only requesting once new segment. (For
example when flushing all the locked segments in
AbstractPagedOutputView.)

Replace OutputViewDataOutputStreamWrapper and
OutputViewObjectOutputStreamWrapper by OutputViewDataOutputWrapper which
is more generic than both.

Add tell() and seek(long) calls in some SerializationTestType child
classes to simulate header writing in PagedViewsTests. Add new
LongAsciiStringType whose length is always bigger than the segment size
to test locking and seeking across segment boundaries.

General cleanup: Consolidate TestOutputViews where several tests had
inner class TestOutputView with same functionality.