Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 1 | package eu.mulk.jgvariant.ostree; |
| 2 | |
| 3 | import eu.mulk.jgvariant.core.Decoder; |
| 4 | import eu.mulk.jgvariant.core.Variant; |
| 5 | import java.nio.ByteOrder; |
| 6 | import java.nio.charset.StandardCharsets; |
Matthias Andreas Benkard | 329168c | 2021-12-28 01:20:05 +0100 | [diff] [blame^] | 7 | import java.util.Map; |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 8 | |
| 9 | /** |
| 10 | * A {@link DeltaSuperblock} signed with some sort of key. |
| 11 | * |
| 12 | * <p>Reference: {@code ostree-repo-static-delta-private.h#OSTREE_STATIC_DELTA_SIGNED_FORMAT} |
| 13 | */ |
| 14 | public record SignedDelta( |
Matthias Andreas Benkard | 329168c | 2021-12-28 01:20:05 +0100 | [diff] [blame^] | 15 | long magicNumber, ByteString superblock, Map<String, Variant> signatures) { |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 16 | |
| 17 | private static final Decoder<SignedDelta> DECODER = |
| 18 | Decoder.ofStructure( |
| 19 | SignedDelta.class, |
| 20 | Decoder.ofLong().withByteOrder(ByteOrder.BIG_ENDIAN), |
| 21 | ByteString.decoder(), |
Matthias Andreas Benkard | 329168c | 2021-12-28 01:20:05 +0100 | [diff] [blame^] | 22 | Decoder.ofDictionary(Decoder.ofString(StandardCharsets.US_ASCII), Decoder.ofVariant())); |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 23 | |
| 24 | public static Decoder<SignedDelta> decoder() { |
| 25 | return DECODER; |
| 26 | } |
| 27 | } |