Eliminate MappableJournalSegmentReader
MappableJournalSegmentReader is an indirection used by
JournalSegmentReader to get a stable reader and the backend is
manipulated via map()/unmap() operations.
This is sort of a band-aid to lifecycle, as JournalSegment.close()
eagerly closes the writer, which in turn invalidates buffer and all that
jazz.
This dance is quite unnecessary, as JournalSegmentReader always acquires
the Segment, hence as long as it has a reader, the segment is guaranteed
to be mapped -- except for the case of close().
This patch reworks the logic in couple of ways:
- references are now guarding the writer itself, so as long as there are
some, the writer is not closed.
- createReader() now increments the reference count, which means we can
directly allocate the appopriate JournalSegmentReader implementation
- JournalSegmentReader.close() now routes to
JournalSegment.closeReader(), which in turn releases the reference
JIRA: CONTROLLER-2098
Change-Id: I29b926dec5dc1a77e7e5e51ee3e2deb4f0ca6e33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>