Class BlobStoreIndexShardSnapshots

  • All Implemented Interfaces:
    java.lang.Iterable<SnapshotFiles>, ToXContent, ToXContentFragment

    public class BlobStoreIndexShardSnapshots
    extends java.lang.Object
    implements java.lang.Iterable<SnapshotFiles>, ToXContentFragment
    Contains information about all snapshots for the given shard in repository

    This class is used to find files that were already snapshotted and clear out files that no longer referenced by any snapshots.

    • Constructor Detail

      • BlobStoreIndexShardSnapshots

        public BlobStoreIndexShardSnapshots​(java.util.List<SnapshotFiles> shardSnapshots)
    • Method Detail

      • snapshots

        public java.util.List<SnapshotFiles> snapshots()
        Returns list of snapshots
        Returns:
        list of snapshots
      • findPhysicalIndexFiles

        public java.util.List<BlobStoreIndexShardSnapshot.FileInfo> findPhysicalIndexFiles​(java.lang.String physicalName)
        Finds reference to a snapshotted file by its original name
        Parameters:
        physicalName - original name
        Returns:
        a list of file infos that match specified physical file or null if the file is not present in any of snapshots
      • findNameFile

        public BlobStoreIndexShardSnapshot.FileInfo findNameFile​(java.lang.String name)
        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

        public java.util.Iterator<SnapshotFiles> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<SnapshotFiles>
      • toXContent

        public XContentBuilder toXContent​(XContentBuilder builder,
                                          ToXContent.Params params)
                                   throws java.io.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:
        toXContent in interface ToXContent
        Throws:
        java.io.IOException