blob: 1b3cc0a069f027063e6f04cee0dddaa6fcb121dc [file] [log] [blame]
Matthias Andreas Benkard4e8423d2021-12-19 22:56:09 +01001package eu.mulk.jgvariant.ostree;
2
3import eu.mulk.jgvariant.core.Decoder;
4import java.nio.ByteOrder;
5
6/**
7 * A fallback entry in a {@link DeltaSuperblock}.
8 *
9 * <p>Reference: {@code ostree-repo-static-delta-private.h#OSTREE_STATIC_DELTA_FALLBACK_FORMAT}
10 */
11public record DeltaFallback(
12 byte objectType, Checksum checksum, long compressedSize, long uncompressedSize) {
13
14 private static final Decoder<DeltaFallback> DECODER =
15 Decoder.ofStructure(
16 DeltaFallback.class,
17 Decoder.ofByte(),
18 Checksum.decoder(),
19 Decoder.ofLong().withByteOrder(ByteOrder.LITTLE_ENDIAN), // FIXME: non-canonical
20 Decoder.ofLong().withByteOrder(ByteOrder.LITTLE_ENDIAN)); // FIXME: non-canonical
21
22 public static Decoder<DeltaFallback> decoder() {
23 return DECODER;
24 }
25}