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 java.nio.ByteBuffer;
13 * An {@link Indexed} entry read from {@link JournalSegment}.
15 * @param checksum The CRC32 checksum of data
16 * @param bytes Entry bytes
18 record SegmentEntry(int checksum, ByteBuffer bytes) {
20 * The size of the header, comprising of:
22 * <li>32-bit signed entry length</li>
23 * <li>32-bit unsigned CRC32 checksum</li>
26 static final int HEADER_BYTES = Integer.BYTES + Integer.BYTES;
29 if (bytes.remaining() < 1) {
30 throw new IllegalArgumentException("Invalid entry bytes " + bytes);