Record Class PushBundle

java.lang.Object
java.lang.Record
ai.badmonkey.agentspaces.pdt.refs.PushBundle
Record Components:
v - VERSION
root - the version's root
seq - the head's seq
part - this part, from 0
parts - the parts of the delta, 1 to MAX_PARTS
nodes - the node bytes of this part

@WireRecord public record PushBundle(int v, String root, long seq, int part, int parts, List<byte[]> nodes) extends Record
One part of a pushed delta (PDT 2 phase 5, P2-P-01; srad/agentspaces-pdt2.md §3.4, §6.10.4): the payload of a rumour on a ref's stream pdt:<space>:<name>. A writer splits the nodes of a version's delta, parents first, into parts of at most MAX_BYTES bytes of nodes. The bundle carries no signature: a receiver stores a node only when it hashes to a CID that the root of a live, signed head reaches (P2-P-02). The record is read strictly (CborCodec.fromWire), and it changes shape only under a new stream prefix (rule 16, P2-F-08); a level-1 member relays the payload by item id without decoding it.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The most bytes of nodes one bundle carries: 1 MiB (§3.4).
    static final int
    The most parts of one delta: a delta of 64 MiB at most, past every push.max-bytes a host may set.
    static final int
    The version of the record.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PushBundle(int v, String root, long seq, int part, int parts, List<byte[]> nodes)
    Creates an instance of a PushBundle record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    List<byte[]>
    Returns the value of the nodes record component.
    int
    Returns the value of the part record component.
    int
    Returns the value of the parts record component.
    Returns the value of the root record component.
    long
    seq()
    Returns the value of the seq record component.
    final String
    Returns a string representation of this record class.
    int
    v()
    Returns the value of the v record component.
    Checks the version, the root, the seq, the part, and the node bytes.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • VERSION

      public static final int VERSION
      The version of the record.
      See Also:
    • MAX_BYTES

      public static final int MAX_BYTES
      The most bytes of nodes one bundle carries: 1 MiB (§3.4).
      See Also:
    • MAX_PARTS

      public static final int MAX_PARTS
      The most parts of one delta: a delta of 64 MiB at most, past every push.max-bytes a host may set.
      See Also:
  • Constructor Details

    • PushBundle

      public PushBundle(int v, String root, long seq, int part, int parts, List<byte[]> nodes)
      Creates an instance of a PushBundle record class.
      Parameters:
      v - the value for the v record component
      root - the value for the root record component
      seq - the value for the seq record component
      part - the value for the part record component
      parts - the value for the parts record component
      nodes - the value for the nodes record component
  • Method Details

    • violation

      public Optional<String> violation()
      Checks the version, the root, the seq, the part, and the node bytes.
      Returns:
      the first violated rule, or empty when the bundle is well formed
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • v

      public int v()
      Returns the value of the v record component.
      Returns:
      the value of the v record component
    • root

      public String root()
      Returns the value of the root record component.
      Returns:
      the value of the root record component
    • seq

      public long seq()
      Returns the value of the seq record component.
      Returns:
      the value of the seq record component
    • part

      public int part()
      Returns the value of the part record component.
      Returns:
      the value of the part record component
    • parts

      public int parts()
      Returns the value of the parts record component.
      Returns:
      the value of the parts record component
    • nodes

      public List<byte[]> nodes()
      Returns the value of the nodes record component.
      Returns:
      the value of the nodes record component