Record Class Manifest

java.lang.Object
java.lang.Record
org.elasticsearch.cluster.metadata.Manifest
All Implemented Interfaces:
ToXContent, ToXContentFragment

public record Manifest(long currentTerm, long clusterStateVersion, long globalGeneration, Map<Index,Long> indexGenerations) extends Record implements ToXContentFragment
This class represents the manifest file, which is the entry point for reading meta data from disk. Metadata consists of global metadata and index metadata. When new version of metadata is written it's assigned some generation long value. Global metadata generation could be obtained by calling globalGeneration(). Index metadata generation could be obtained by calling indexGenerations().
  • Field Details

  • Constructor Details

    • Manifest

      public Manifest(long currentTerm, long clusterStateVersion, long globalGeneration, Map<Index,Long> indexGenerations)
      Creates an instance of a Manifest record class.
      Parameters:
      currentTerm - the value for the currentTerm record component
      clusterStateVersion - the value for the clusterStateVersion record component
      globalGeneration - the value for the globalGeneration record component
      indexGenerations - the value for the indexGenerations record component
  • Method Details

    • unknownCurrentTermAndVersion

      public static Manifest unknownCurrentTermAndVersion(long globalGeneration, Map<Index,Long> indexGenerations)
    • toXContent

      public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface ToXContent
      Throws:
      IOException
    • fromXContent

      public static Manifest fromXContent(XContentParser parser) throws IOException
      Throws:
      IOException
    • isEmpty

      public boolean isEmpty()
    • empty

      public static Manifest empty()
    • isGlobalGenerationMissing

      public boolean isGlobalGenerationMissing()
    • 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 '=='.
      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.
    • currentTerm

      public long currentTerm()
      Returns the value of the currentTerm record component.
      Returns:
      the value of the currentTerm record component
    • clusterStateVersion

      public long clusterStateVersion()
      Returns the value of the clusterStateVersion record component.
      Returns:
      the value of the clusterStateVersion record component
    • globalGeneration

      public long globalGeneration()
      Returns the value of the globalGeneration record component.
      Returns:
      the value of the globalGeneration record component
    • indexGenerations

      public Map<Index,Long> indexGenerations()
      Returns the value of the indexGenerations record component.
      Returns:
      the value of the indexGenerations record component