Class RepositoriesMetadata

java.lang.Object
org.elasticsearch.cluster.AbstractNamedDiffable<Metadata.Custom>
org.elasticsearch.cluster.metadata.RepositoriesMetadata
All Implemented Interfaces:
ClusterState.FeatureAware, Diffable<Metadata.Custom>, Metadata.Custom, NamedDiffable<Metadata.Custom>, NamedWriteable, VersionedNamedWriteable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public class RepositoriesMetadata
extends AbstractNamedDiffable<Metadata.Custom>
implements Metadata.Custom
Contains metadata about registered snapshot repositories
  • Field Details

  • Constructor Details

    • RepositoriesMetadata

      public RepositoriesMetadata​(java.util.List<RepositoryMetadata> repositories)
      Constructs new repository metadata
      Parameters:
      repositories - list of repositories
    • RepositoriesMetadata

      public RepositoriesMetadata​(StreamInput in) throws java.io.IOException
      Throws:
      java.io.IOException
  • Method Details

    • withUpdatedGeneration

      public RepositoriesMetadata withUpdatedGeneration​(java.lang.String repoName, long safeGeneration, long pendingGeneration)
      Creates a new instance that has the given repository moved to the given safeGeneration and pendingGeneration.
      Parameters:
      repoName - repository name
      safeGeneration - new safe generation
      pendingGeneration - new pending generation
      Returns:
      new instance with updated generations
    • withUuid

      public RepositoriesMetadata withUuid​(java.lang.String repoName, java.lang.String uuid)
      Creates a new instance that records the UUID of the given repository.
      Parameters:
      repoName - repository name
      uuid - repository uuid
      Returns:
      new instance with updated uuid
    • repositories

      public java.util.List<RepositoryMetadata> repositories()
      Returns list of currently registered repositories
      Returns:
      list of repositories
    • repository

      public RepositoryMetadata repository​(java.lang.String name)
      Returns a repository with a given name or null if such repository doesn't exist
      Parameters:
      name - name of repository
      Returns:
      repository metadata
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • equalsIgnoreGenerations

      public boolean equalsIgnoreGenerations​(@Nullable RepositoriesMetadata other)
      Checks if this instance and the given instance share the same repositories by checking that this instances' repositories and the repositories in other are equal or only differ in their values of RepositoryMetadata.generation() and RepositoryMetadata.pendingGeneration().
      Parameters:
      other - other repositories metadata
      Returns:
      true iff both instances contain the same repositories apart from differences in generations
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • getWriteableName

      public java.lang.String getWriteableName()
      Returns the name of the writeable object
      Specified by:
      getWriteableName in interface NamedWriteable
      Specified by:
      getWriteableName in interface VersionedNamedWriteable
    • getMinimalSupportedVersion

      public Version getMinimalSupportedVersion()
      Description copied from interface: VersionedNamedWriteable
      The minimal version of the recipient this object can be sent to
      Specified by:
      getMinimalSupportedVersion in interface VersionedNamedWriteable
    • readDiffFrom

      public static NamedDiff<Metadata.Custom> readDiffFrom​(StreamInput in) throws java.io.IOException
      Throws:
      java.io.IOException
    • writeTo

      public void writeTo​(StreamOutput out) throws java.io.IOException
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      java.io.IOException
    • fromXContent

      public static RepositoriesMetadata fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOException
      Throws:
      java.io.IOException
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException
    • context

      public java.util.EnumSet<Metadata.XContentContext> context()
      Specified by:
      context in interface Metadata.Custom
    • toXContent

      public static void toXContent​(RepositoryMetadata repository, org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Serializes information about a single repository
      Parameters:
      repository - repository metadata
      builder - XContent builder
      params - serialization parameters
      Throws:
      java.io.IOException
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object