Record Class Bodies.Ack

java.lang.Object
java.lang.Record
ai.badmonkey.agentspaces.peering.wire.Bodies.Ack
Record Components:
nonce - the correlated PING or PING_REQ nonce
onBehalf - the probed peer when this ACK answers a PING_REQ; else null
root - SHA-256 over the sender's per-stream digest hashes, or null
hashes - SHA-256 of the sender's digest per stream, or null
have - the sender's recently forwarded items, or null
Enclosing class:
Bodies

public static record Bodies.Ack(long nonce, PeerId onBehalf, byte[] root, Map<String,byte[]> hashes, List<Bodies.HaveItem> have) extends Record
ACK body, with the same piggyback as the PING (v0.1.17), null when relayed or from older nodes.
  • Constructor Details

    • Ack

      public Ack(long nonce, PeerId onBehalf)
      A bare acknowledgement, as older nodes and relays send it.
    • Ack

      public Ack(long nonce, PeerId onBehalf, byte[] root, Map<String,byte[]> hashes, List<Bodies.HaveItem> have)
      Creates an instance of a Ack record class.
      Parameters:
      nonce - the value for the nonce record component
      onBehalf - the value for the onBehalf record component
      root - the value for the root record component
      hashes - the value for the hashes record component
      have - the value for the have record component
  • Method Details

    • 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.
    • nonce

      public long nonce()
      Returns the value of the nonce record component.
      Returns:
      the value of the nonce record component
    • onBehalf

      public PeerId onBehalf()
      Returns the value of the onBehalf record component.
      Returns:
      the value of the onBehalf record component
    • root

      public byte[] root()
      Returns the value of the root record component.
      Returns:
      the value of the root record component
    • hashes

      public Map<String,byte[]> hashes()
      Returns the value of the hashes record component.
      Returns:
      the value of the hashes record component
    • have

      public List<Bodies.HaveItem> have()
      Returns the value of the have record component.
      Returns:
      the value of the have record component