public final class RepositoryData
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static RepositoryData |
EMPTY
An instance initialized for an empty repository.
|
static long |
EMPTY_REPO_GEN
The generation value indicating the repository has no index generational files.
|
Constructor and Description |
---|
RepositoryData(long genId,
java.util.List<SnapshotId> snapshotIds,
java.util.Map<IndexId,java.util.Set<SnapshotId>> indexSnapshots,
java.util.List<SnapshotId> incompatibleSnapshotIds) |
Modifier and Type | Method and Description |
---|---|
RepositoryData |
addIncompatibleSnapshots(java.util.List<SnapshotId> incompatibleSnapshotIds)
Returns a new
RepositoryData instance containing the same snapshot data as the
invoking instance, with the given incompatible snapshots added to the new instance. |
RepositoryData |
addSnapshot(SnapshotId snapshotId,
java.util.List<IndexId> snapshottedIndices)
Add a snapshot and its indices to the repository; returns a new instance.
|
protected RepositoryData |
copy() |
boolean |
equals(java.lang.Object obj) |
java.util.List<SnapshotId> |
getAllSnapshotIds()
Returns an immutable collection of all the snapshot ids in the repository, both active and
incompatible snapshots.
|
long |
getGenId()
Gets the generational index file id from which this instance was read.
|
java.util.List<SnapshotId> |
getIncompatibleSnapshotIds()
Returns an immutable collection of the snapshot ids in the repository that are incompatible with the
current ES version.
|
java.util.Map<java.lang.String,IndexId> |
getIndices()
Returns an unmodifiable map of the index names to
IndexId in the repository. |
java.util.List<SnapshotId> |
getSnapshotIds()
Returns an unmodifiable list of the snapshot ids.
|
java.util.Set<SnapshotId> |
getSnapshots(IndexId indexId)
Returns an immutable collection of the snapshot ids for the snapshots that contain the given index.
|
int |
hashCode() |
RepositoryData |
incompatibleSnapshotsFromXContent(XContentParser parser)
Reads the incompatible snapshot ids from x-content, loading them into a new instance of
RepositoryData
that is created from the invoking instance, plus the incompatible snapshots that are read from x-content. |
XContentBuilder |
incompatibleSnapshotsToXContent(XContentBuilder builder,
ToXContent.Params params)
Writes the incompatible snapshot ids to x-content.
|
RepositoryData |
initIndices(java.util.Map<IndexId,java.util.Set<SnapshotId>> indexSnapshots)
Initializes the indices in the repository metadata; returns a new instance.
|
RepositoryData |
removeSnapshot(SnapshotId snapshotId)
Remove a snapshot and remove any indices that no longer exist in the repository due to the deletion of the snapshot.
|
IndexId |
resolveIndexId(java.lang.String indexName)
Resolve the index name to the index id specific to the repository,
throwing an exception if the index could not be resolved.
|
java.util.List<IndexId> |
resolveIndices(java.util.List<java.lang.String> indices)
Resolve the given index names to index ids.
|
java.util.List<IndexId> |
resolveNewIndices(java.util.List<java.lang.String> indicesToResolve)
Resolve the given index names to index ids, creating new index ids for
new indices in the repository.
|
static RepositoryData |
snapshotsFromXContent(XContentParser parser,
long genId)
Reads an instance of
RepositoryData from x-content, loading the snapshots and indices metadata. |
XContentBuilder |
snapshotsToXContent(XContentBuilder builder,
ToXContent.Params params)
Writes the snapshots metadata and the related indices metadata to x-content, omitting the
incompatible snapshots.
|
public static final long EMPTY_REPO_GEN
public static final RepositoryData EMPTY
public RepositoryData(long genId, java.util.List<SnapshotId> snapshotIds, java.util.Map<IndexId,java.util.Set<SnapshotId>> indexSnapshots, java.util.List<SnapshotId> incompatibleSnapshotIds)
protected RepositoryData copy()
public long getGenId()
public java.util.List<SnapshotId> getSnapshotIds()
public java.util.List<SnapshotId> getIncompatibleSnapshotIds()
public java.util.List<SnapshotId> getAllSnapshotIds()
public java.util.Map<java.lang.String,IndexId> getIndices()
IndexId
in the repository.public RepositoryData addSnapshot(SnapshotId snapshotId, java.util.List<IndexId> snapshottedIndices)
public RepositoryData removeSnapshot(SnapshotId snapshotId)
public RepositoryData addIncompatibleSnapshots(java.util.List<SnapshotId> incompatibleSnapshotIds)
RepositoryData
instance containing the same snapshot data as the
invoking instance, with the given incompatible snapshots added to the new instance.public java.util.Set<SnapshotId> getSnapshots(IndexId indexId)
public RepositoryData initIndices(java.util.Map<IndexId,java.util.Set<SnapshotId>> indexSnapshots)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public IndexId resolveIndexId(java.lang.String indexName)
public java.util.List<IndexId> resolveIndices(java.util.List<java.lang.String> indices)
public java.util.List<IndexId> resolveNewIndices(java.util.List<java.lang.String> indicesToResolve)
public XContentBuilder snapshotsToXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOException
public static RepositoryData snapshotsFromXContent(XContentParser parser, long genId) throws java.io.IOException
RepositoryData
from x-content, loading the snapshots and indices metadata.java.io.IOException
public XContentBuilder incompatibleSnapshotsToXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOException
public RepositoryData incompatibleSnapshotsFromXContent(XContentParser parser) throws java.io.IOException
RepositoryData
that is created from the invoking instance, plus the incompatible snapshots that are read from x-content.java.io.IOException