JournalSegment should look at StorageLevel and pick the appropriate
writer instead of always using FileChannelJournalSegment.
JIRA: CONTROLLER-2099
Change-Id: I060618a2808a837214b5ae61f4860f329c1799f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
} catch (IOException e) {
throw new StorageException(e);
}
- writer = new FileChannelJournalSegmentWriter<>(channel, this, maxEntrySize, index, namespace);
+ writer = switch (storageLevel) {
+ case DISK -> new FileChannelJournalSegmentWriter<>(channel, this, maxEntrySize, index, namespace);
+ case MAPPED -> new MappedJournalSegmentWriter<>(channel, this, maxEntrySize, index, namespace).toFileChannel();
+ };
}
/**