public void parseLocal()

in priam/src/main/java/com/netflix/priam/backup/AbstractBackupPath.java [107:147]


    public void parseLocal(File file, BackupFileType type) {
        this.backupFile = file;
        this.baseDir = config.getBackupLocation();
        this.clusterName = config.getAppName();
        this.fileName = file.getName();
        BasicFileAttributes fileAttributes;
        try {
            fileAttributes = Files.readAttributes(file.toPath(), BasicFileAttributes.class);
            this.lastModified = fileAttributes.lastModifiedTime().toInstant();
            this.creationTime = fileAttributes.creationTime().toInstant();
            this.size = fileAttributes.size();
        } catch (IOException e) {
            this.lastModified = Instant.ofEpochMilli(0L);
            this.creationTime = Instant.ofEpochMilli(0L);
            this.size = 0L;
        }
        this.region = instanceIdentity.getInstanceInfo().getRegion();
        this.token = instanceIdentity.getInstance().getToken();
        this.type = type;
        String rpath =
                new File(config.getDataFileLocation()).toURI().relativize(file.toURI()).getPath();
        String[] parts = rpath.split("" + PATH_SEP);
        if (BackupFileType.isDataFile(type)) {
            this.keyspace = parts[0];
            this.columnFamily = parts[1];
        }
        if (BackupFileType.isDataFile(type)) {
            Optional<BackupFolder> folder = BackupFolder.fromName(parts[2]);
            this.isIncremental = folder.filter(BackupFolder.BACKUPS::equals).isPresent();
        }

        /*
        1. For old style snapshots, make this value to time at which backup was executed.
        2. This is to ensure that all the files from the snapshot are uploaded under single directory in remote file system.
        3. For META file we always override the time field via @link{Metadata#decorateMetaJson}
        */
        this.time =
                type == BackupFileType.SNAP
                        ? DateUtil.getDate(parts[3])
                        : new Date(lastModified.toEpochMilli());
    }