Properly document jgvariant-ostree.
Change-Id: I0aa3b1df512ef99d0e25d73efdd34a1b488e7d0d
diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DeltaPartPayload.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DeltaPartPayload.java
index c8c5fe7..7f7dd23 100644
--- a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DeltaPartPayload.java
+++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DeltaPartPayload.java
@@ -5,13 +5,25 @@
import java.util.List;
/**
- * Reference: {@code ostree-repo-static-delta-private.h#OSTREE_STATIC_DELTA_PART_PAYLOAD_FORMAT_V0}
+ * A payload file from a static delta.
+ *
+ * <p>The first byte is a compression byte: {@code 0} for none, {@code 'x'} for LZMA. The actual
+ * GVariant data begins right after.
+ *
+ * <p>Reference: {@code
+ * ostree-repo-static-delta-private.h#OSTREE_STATIC_DELTA_PART_PAYLOAD_FORMAT_V0}
+ *
+ * @param fileModes the {@link FileMode}s of the files generated by this delta payload.
+ * @param xattrs the {@link Xattr}s of the files generated by this delta payload.
+ * @param rawDataSource the data bytes used in the delta operations.
+ * @param operations the operations to apply during delta patching.
+ * @see DeltaSuperblock
*/
public record DeltaPartPayload(
List<FileMode> fileModes,
List<List<Xattr>> xattrs,
ByteString rawDataSource,
- ByteString operations) {
+ List<DeltaOperation> operations) {
private static final Decoder<DeltaPartPayload> DECODER =
Decoder.ofStructure(
@@ -19,8 +31,19 @@
Decoder.ofArray(FileMode.decoder()),
Decoder.ofArray(Decoder.ofArray(Xattr.decoder())),
ByteString.decoder(),
- ByteString.decoder());
+ ByteString.decoder().map(DeltaPartPayload::parseDeltaOperationList));
+ private static List<DeltaOperation> parseDeltaOperationList(ByteString byteString) {
+ return byteString.stream().map(DeltaOperation::valueOf).toList();
+ }
+
+ /**
+ * A file mode triple (UID, GID, and permission bits).
+ *
+ * @param uid
+ * @param gid
+ * @param mode
+ */
public record FileMode(int uid, int gid, int mode) {
private static final Decoder<FileMode> DECODER =
@@ -30,11 +53,24 @@
Decoder.ofInt().withByteOrder(ByteOrder.LITTLE_ENDIAN),
Decoder.ofInt().withByteOrder(ByteOrder.LITTLE_ENDIAN));
+ /**
+ * Acquires a {@link Decoder} for the enclosing type.
+ *
+ * @return a possibly shared {@link Decoder}.
+ */
public static Decoder<FileMode> decoder() {
return DECODER;
}
}
+ /**
+ * Acquires a {@link Decoder} for the enclosing type.
+ *
+ * <p>FIXME: The first byte is actually a compression byte: {@code 0} for none, {@code 'x'} for
+ * LZMA.
+ *
+ * @return a possibly shared {@link Decoder}.
+ */
public static Decoder<DeltaPartPayload> decoder() {
return DECODER;
}