Class BackupFilePaths


  • public class BackupFilePaths
    extends Object
    Utility class for getting paths related to backups, or parsing information out of those paths.
    • Constructor Detail

      • BackupFilePaths

        public BackupFilePaths​(BackupRepository repository,
                               URI backupLoc)
        Create a BackupFilePaths object.
        Parameters:
        repository - the repository; used primarily to resolve URIs.
        backupLoc - the root location for a named backup. For traditional backups this is expected to take the form baseLocation/backupName. For incremental backups this is expected to be of the form baseLocation/backupName/collectionName.
    • Method Detail

      • getIndexDir

        public URI getIndexDir()
        Return a URI for the 'index' location, responsible for holding index files for all backups at this location.

        Only valid for incremental backups.

      • getShardBackupMetadataDir

        public URI getShardBackupMetadataDir()
        Return a URI for the 'shard_backup_metadata' location, which contains metadata files about each shard backup.

        Only valid for incremental backups.

      • getBackupLocation

        public URI getBackupLocation()
      • createIncrementalBackupFolders

        public void createIncrementalBackupFolders()
                                            throws IOException
        Create all locations required to store an incremental backup.
        Throws:
        IOException - for issues encountered using repository to create directories
      • getZkStateDir

        public static String getZkStateDir​(BackupId id)
        Get the directory name used to hold backed up ZK state

        Valid for both incremental and traditional backups.

        Parameters:
        id - the ID of the backup in question
      • getBackupPropsName

        public static String getBackupPropsName​(BackupId id)
        Get the filename of the top-level backup properties file

        Valid for both incremental and traditional backups.

        Parameters:
        id - the ID of the backup in question
      • findAllBackupIdsFromFileListing

        public static List<BackupId> findAllBackupIdsFromFileListing​(String[] listFiles)
        Identify all strings which appear to be the filename of a top-level backup properties file.

        Only valid for incremental backups.

        Parameters:
        listFiles - a list of strings, filenames which may or may not correspond to backup properties files
      • findMostRecentBackupIdFromFileListing

        public static Optional<BackupId> findMostRecentBackupIdFromFileListing​(String[] listFiles)
        Identify the string from an array of filenames which represents the most recent top-level backup properties file.

        Only valid for incremental backups.

        Parameters:
        listFiles - a list of strings, filenames which may or may not correspond to backup properties files.
      • buildExistingBackupLocationURI

        public static URI buildExistingBackupLocationURI​(BackupRepository repository,
                                                         URI location,
                                                         String backupName)
                                                  throws IOException
        Builds the URI for the backup location given the user-provided 'location' and backup 'name'.
        Parameters:
        repository - the backup repository, used to list files and resolve URI's.
        location - a URI representing the repository location holding each backup name
        backupName - the specific backup name to create a URI for
        Throws:
        IOException