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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic RepositoriesMetadata
static String
Serialization parameter used to hide theRepositoryMetadata.generation()
andRepositoryMetadata.pendingGeneration()
inGetRepositoriesResponse
.static String
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionRepositoriesMetadata(List<RepositoryMetadata> repositories)
Constructs new repository metadata -
Method Summary
Modifier and TypeMethodDescriptioncontext()
boolean
boolean
Checks if this instance and the given instance share the same repositories by checking that this instances' repositories and the repositories inother
are equal or only differ in their values ofRepositoryMetadata.generation()
andRepositoryMetadata.pendingGeneration()
.static RepositoriesMetadata
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
The minimal version of the recipient this object can be sent toReturns the name of the writeable objectint
hashCode()
static NamedDiff<Metadata.Custom>
Returns list of currently registered repositoriesrepository(String name)
Returns a repository with a given name or null if such repository doesn't existtoString()
static void
toXContent(RepositoryMetadata repository, org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
Serializes information about a single repositoryorg.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
withUpdatedGeneration(String repoName, long safeGeneration, long pendingGeneration)
Creates a new instance that has the given repository moved to the givensafeGeneration
andpendingGeneration
.Creates a new instance that records the UUID of the given repository.void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.elasticsearch.cluster.AbstractNamedDiffable
diff, get, readDiffFrom
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.cluster.ClusterState.FeatureAware
getRequiredFeature
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
TYPE
- See Also:
- Constant Field Values
-
EMPTY
-
HIDE_GENERATIONS_PARAM
Serialization parameter used to hide theRepositoryMetadata.generation()
andRepositoryMetadata.pendingGeneration()
inGetRepositoriesResponse
.- See Also:
- Constant Field Values
-
-
Constructor Details
-
RepositoriesMetadata
Constructs new repository metadata- Parameters:
repositories
- list of repositories
-
RepositoriesMetadata
- Throws:
IOException
-
-
Method Details
-
withUpdatedGeneration
public RepositoriesMetadata withUpdatedGeneration(String repoName, long safeGeneration, long pendingGeneration)Creates a new instance that has the given repository moved to the givensafeGeneration
andpendingGeneration
.- Parameters:
repoName
- repository namesafeGeneration
- new safe generationpendingGeneration
- new pending generation- Returns:
- new instance with updated generations
-
withUuid
Creates a new instance that records the UUID of the given repository.- Parameters:
repoName
- repository nameuuid
- repository uuid- Returns:
- new instance with updated uuid
-
repositories
Returns list of currently registered repositories- Returns:
- list of repositories
-
repository
Returns a repository with a given name or null if such repository doesn't exist- Parameters:
name
- name of repository- Returns:
- repository metadata
-
equals
-
equalsIgnoreGenerations
Checks if this instance and the given instance share the same repositories by checking that this instances' repositories and the repositories inother
are equal or only differ in their values ofRepositoryMetadata.generation()
andRepositoryMetadata.pendingGeneration()
.- Parameters:
other
- other repositories metadata- Returns:
true
iff both instances contain the same repositories apart from differences in generations
-
hashCode
public int hashCode() -
getWriteableName
Returns the name of the writeable object- Specified by:
getWriteableName
in interfaceNamedWriteable
- Specified by:
getWriteableName
in interfaceVersionedNamedWriteable
-
getMinimalSupportedVersion
Description copied from interface:VersionedNamedWriteable
The minimal version of the recipient this object can be sent to- Specified by:
getMinimalSupportedVersion
in interfaceVersionedNamedWriteable
-
readDiffFrom
- Throws:
IOException
-
writeTo
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
fromXContent
public static RepositoriesMetadata fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-
context
- Specified by:
context
in interfaceMetadata.Custom
-
toXContent
public static void toXContent(RepositoryMetadata repository, org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOExceptionSerializes information about a single repository- Parameters:
repository
- repository metadatabuilder
- XContent builderparams
- serialization parameters- Throws:
IOException
-
toString
-