Module org.elasticsearch.server
Class BlobStoreIndexShardSnapshots
java.lang.Object
org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshots
- All Implemented Interfaces:
Iterable<SnapshotFiles>,ToXContent,ToXContentFragment
public class BlobStoreIndexShardSnapshots
extends Object
implements Iterable<SnapshotFiles>, ToXContentFragment
Contains information about all snapshots for the given shard in repository
This class is used to find shard files that were already snapshotted and clear out shard files that are no longer referenced by any snapshots of the shard.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params -
Field Summary
FieldsFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanfindNameFile(String name) Finds reference to a snapshotted file by its snapshot namefindPhysicalIndexFile(StoreFileMetadata storeFileMetadata) Finds reference to a snapshotted file by itsStoreFileMetadatastatic BlobStoreIndexShardSnapshotsfromXContent(XContentParser parser) iterator()Returns list of snapshotstoXContent(XContentBuilder builder, ToXContent.Params params) Writes index file for the shard in the following format.withAddedSnapshot(SnapshotFiles snapshotFiles) Creates a new list of the shard's snapshots (BlobStoreIndexShardSnapshots) adding a new shard snapshot (SnapshotFiles).Create a new instance that has a new snapshot by nametargetadded which shares all files with the snapshot of namesource.withRetainedSnapshots(Set<SnapshotId> retainedSnapshots) Creates a new list of the shard's snapshots (BlobStoreIndexShardSnapshots) retaining only the shard snapshots specified by ID inretainedSnapshots.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
EMPTY
-
-
Method Details
-
withRetainedSnapshots
Creates a new list of the shard's snapshots (BlobStoreIndexShardSnapshots) retaining only the shard snapshots specified by ID inretainedSnapshots. Typically used for snapshot deletions, which reduce the shard snapshots. -
withAddedSnapshot
Creates a new list of the shard's snapshots (BlobStoreIndexShardSnapshots) adding a new shard snapshot (SnapshotFiles). -
withClone
Create a new instance that has a new snapshot by nametargetadded which shares all files with the snapshot of namesource.- Parameters:
source- source snapshot nametarget- target snapshot name- Returns:
- new instance with added cloned snapshot
-
snapshots
Returns list of snapshots- Returns:
- list of snapshots
-
findPhysicalIndexFile
public BlobStoreIndexShardSnapshot.FileInfo findPhysicalIndexFile(StoreFileMetadata storeFileMetadata) Finds reference to a snapshotted file by itsStoreFileMetadata- Parameters:
storeFileMetadata- store file metadata to find file info for- Returns:
- the file info that matches the specified physical file or null if the file is not present in any of snapshots
-
findNameFile
Finds reference to a snapshotted file by its snapshot name- Parameters:
name- file name- Returns:
- file info or null if file is not present in any of snapshots
-
iterator
- Specified by:
iteratorin interfaceIterable<SnapshotFiles>
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException Writes index file for the shard in the following format.{ "files": [{ "name": "__3", "physical_name": "_0.si", "length": 310, "checksum": "1tpsg3p", "written_by": "5.1.0", "meta_hash": "P9dsFxNMdWNlb......" }, { "name": "__2", "physical_name": "segments_2", "length": 150, "checksum": "11qjpz6", "written_by": "5.1.0", "meta_hash": "P9dsFwhzZWdtZ......." }, { "name": "__1", "physical_name": "_0.cfe", "length": 363, "checksum": "er9r9g", "written_by": "5.1.0" }, { "name": "__0", "physical_name": "_0.cfs", "length": 3354, "checksum": "491liz", "written_by": "5.1.0" }, { "name": "__4", "physical_name": "segments_3", "length": 150, "checksum": "134567", "written_by": "5.1.0", "meta_hash": "P9dsFwhzZWdtZ......." }], "snapshots": { "snapshot_1": { "files": ["__0", "__1", "__2", "__3"] }, "snapshot_2": { "files": ["__0", "__1", "__2", "__4"] } } } }- Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
areIntegrityAssertionsEnabled
public static boolean areIntegrityAssertionsEnabled() -
fromXContent
- Throws:
IOException
-