Record Class RedundancySignature

java.lang.Object
java.lang.Record
com.inductiveautomation.ignition.gateway.redundancy.types.RedundancySignature
Record Components:
id - An id that is unique to an object in the gateway, such as a UUID or a full path. Implements Comparable since the ids have to be sorted in a consistent way to generate a digest of object signatures. Also, the id's equals() and hashcode() methods may need to be overridden, to ensure that ids can be properly compared to whatever makes them unique.
digest - An ImmutableBytes value that is derived by calculating an object's signature using the SHA-256 algorithm. Use DigestBuilder.sha256() to add message properties to a DigestBuilder, then use DigestBuilder.build() to encode the digest into bytes for comparison. IMPORTANT When adding items to a DigestBuilder, they absolutely must be added in a repeatable order. Failure to do so can result in the digest calculation being different for objects with the same properties.

public record RedundancySignature(Comparable<?> id, ImmutableBytes digest) extends Record
A RedundancySignature is used to compare an object between gateways. If the calculated digests are the same, the underlying objects are the same as well. If they are different, then a BasicRedundancyDiff needs to be created, and the more up-to-date object needs to be added to the diff so that it can be applied to the other gateway.
  • Constructor Details

    • RedundancySignature

      public RedundancySignature(Comparable<?> id, ImmutableBytes digest)
      Creates an instance of a RedundancySignature record class.
      Parameters:
      id - the value for the id record component
      digest - the value for the digest record component
  • Method Details

    • toString

      public 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • id

      public Comparable<?> id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • digest

      public ImmutableBytes digest()
      Returns the value of the digest record component.
      Returns:
      the value of the digest record component