Module org.elasticsearch.server
Class RepositoriesMetadata
java.lang.Object
org.elasticsearch.cluster.AbstractNamedDiffable<Metadata.Custom>
org.elasticsearch.cluster.metadata.RepositoriesMetadata
- All Implemented Interfaces:
Diffable<Metadata.Custom>,Metadata.Custom,NamedDiffable<Metadata.Custom>,NamedWriteable,VersionedNamedWriteable,Writeable,ChunkedToXContent
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.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RepositoriesMetadatastatic final StringSerialization parameter used to hide theRepositoryMetadata.generation()andRepositoryMetadata.pendingGeneration()inGetRepositoriesResponse.static final String -
Constructor Summary
ConstructorsConstructorDescriptionRepositoriesMetadata(List<RepositoryMetadata> repositories) Constructs new repository metadata -
Method Summary
Modifier and TypeMethodDescriptioncontext()booleanbooleanChecks if this instance and the given instance share the same repositories by checking that this instances' repositories and the repositories inotherare equal or only differ in their values ofRepositoryMetadata.generation()andRepositoryMetadata.pendingGeneration().static RepositoriesMetadatafromXContent(XContentParser parser) static RepositoriesMetadataget(ClusterState state) The minimal version of the recipient this object can be sent toReturns the name of the writeable objectinthashCode()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 XContentBuildertoXContent(RepositoryMetadata repository, XContentBuilder builder, ToXContent.Params params) Serializes information about a single repositoryIterator<? extends ToXContent> toXContentChunked(ToXContent.Params ignored) Create an iterator ofToXContentchunks for a REST response.withUpdatedGeneration(String repoName, long safeGeneration, long pendingGeneration) Creates a new instance that has the given repository moved to the givensafeGenerationandpendingGeneration.Creates a new instance that records the UUID of the given repository.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class org.elasticsearch.cluster.AbstractNamedDiffable
diff, get, readDiffFromMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
isFragment, toXContentChunkedV7Methods inherited from interface org.elasticsearch.cluster.metadata.Metadata.Custom
isRestorable
-
Field Details
-
TYPE
- See Also:
-
EMPTY
-
HIDE_GENERATIONS_PARAM
Serialization parameter used to hide theRepositoryMetadata.generation()andRepositoryMetadata.pendingGeneration()inGetRepositoriesResponse.- See Also:
-
-
Constructor Details
-
RepositoriesMetadata
Constructs new repository metadata- Parameters:
repositories- list of repositories
-
RepositoriesMetadata
- Throws:
IOException
-
-
Method Details
-
get
-
withUpdatedGeneration
public RepositoriesMetadata withUpdatedGeneration(String repoName, long safeGeneration, long pendingGeneration) Creates a new instance that has the given repository moved to the givensafeGenerationandpendingGeneration.- 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 inotherare equal or only differ in their values ofRepositoryMetadata.generation()andRepositoryMetadata.pendingGeneration().- Parameters:
other- other repositories metadata- Returns:
trueiff 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:
getWriteableNamein interfaceNamedWriteable- Specified by:
getWriteableNamein interfaceVersionedNamedWriteable
-
getMinimalSupportedVersion
Description copied from interface:VersionedNamedWriteableThe minimal version of the recipient this object can be sent to- Specified by:
getMinimalSupportedVersionin interfaceVersionedNamedWriteable
-
readDiffFrom
- Throws:
IOException
-
writeTo
Write this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
fromXContent
- Throws:
IOException
-
toXContentChunked
Description copied from interface:ChunkedToXContentCreate an iterator ofToXContentchunks for a REST response. Each chunk is serialized with the sameXContentBuilderandToXContent.Params, which is also the same as theToXContent.Paramspassed as theparamsargument. For best results, all chunks should beO(1)size. The last chunk in the iterator must always yield at least one byte of output. See alsoChunkedToXContentHelperfor some handy utilities.Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.
- Specified by:
toXContentChunkedin interfaceChunkedToXContent- Returns:
- iterator over chunks of
ToXContent
-
context
- Specified by:
contextin interfaceMetadata.Custom
-
toXContent
public static XContentBuilder toXContent(RepositoryMetadata repository, XContentBuilder builder, ToXContent.Params params) throws IOException Serializes information about a single repository- Parameters:
repository- repository metadatabuilder- XContent builderparams- serialization parameters- Throws:
IOException
-
toString
-