Record Class RepositoryArtifactChunk

java.lang.Object
java.lang.Record
org.j7m.middleware.application.api.replication.RepositoryArtifactChunk
Record Components:
transferId - stable transfer identifier
digest - artifact digest descriptor
sequence - zero-based chunk sequence
totalChunks - total chunk count
chunkDigest - SHA-256 digest of this chunk payload
bytes - chunk bytes, defensively copied
All Implemented Interfaces:
Serializable

public record RepositoryArtifactChunk(String transferId, RepositoryArtifactDigest digest, int sequence, int totalChunks, String chunkDigest, byte[] bytes) extends Record implements Serializable
Bounded artifact transfer chunk.
See Also:
  • Constructor Details

    • RepositoryArtifactChunk

      public RepositoryArtifactChunk(String transferId, RepositoryArtifactDigest digest, int sequence, int totalChunks, String chunkDigest, byte[] bytes)
      Creates a validated immutable chunk.
    • RepositoryArtifactChunk

      public RepositoryArtifactChunk(RepositoryArtifactDigest digest, int sequence, int totalChunks, byte[] bytes)
      Compatibility constructor for callers that do not provide transfer or chunk-digest metadata.
      Parameters:
      digest - artifact digest descriptor
      sequence - zero-based chunk sequence
      totalChunks - total chunk count
      bytes - chunk bytes
  • Method Details

    • bytes

      public byte[] bytes()
      Returns a defensive copy of the chunk bytes.
      Returns:
      chunk bytes
    • 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.
    • transferId

      public String transferId()
      Returns the value of the transferId record component.
      Returns:
      the value of the transferId record component
    • digest

      public RepositoryArtifactDigest digest()
      Returns the value of the digest record component.
      Returns:
      the value of the digest record component
    • sequence

      public int sequence()
      Returns the value of the sequence record component.
      Returns:
      the value of the sequence record component
    • totalChunks

      public int totalChunks()
      Returns the value of the totalChunks record component.
      Returns:
      the value of the totalChunks record component
    • chunkDigest

      public String chunkDigest()
      Returns the value of the chunkDigest record component.
      Returns:
      the value of the chunkDigest record component