2 * Copyright (c) 2024 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package io.atomix.storage.journal;
10 import static java.util.Objects.requireNonNull;
12 import io.atomix.storage.journal.index.JournalIndex;
14 abstract sealed class JournalSegmentReader<E> implements JournalReader<E>
15 permits FileChannelJournalSegmentReader, MappedJournalSegmentReader {
16 final int maxEntrySize;
17 final JournalIndex index;
18 final JournalSerdes namespace;
19 final long firstIndex;
21 JournalSegmentReader(final JournalSegment<E> segment, final int maxEntrySize, final JournalIndex index,
22 final JournalSerdes namespace) {
23 this.maxEntrySize = maxEntrySize;
24 this.index = requireNonNull(index);
25 this.namespace = requireNonNull(namespace);
26 this.firstIndex = segment.index();
30 public final long getFirstIndex() {
35 public final void close() {
36 // FIXME: CONTROLLER-2098: remove this method