Interface ActiveBitPreservation

  • All Known Implementing Classes:
    DatabaseBasedActiveBitPreservation, FileBasedActiveBitPreservation

    public interface ActiveBitPreservation
    All bitpreservation implementations are assumed to have access to admin data and bitarchives. Operations may request information from the bitarchive by sending batch jobs, reading admin data directly, or reading from cached information from either.
    • Method Detail

      • getPreservationStateMap

        Map<String,​PreservationState> getPreservationStateMap​(String... filenames)
        Get details of the state of one or more files in the bitarchives and admin data.
        Parameters:
        filenames - the list of filenames to investigate
        Returns:
        a map ([filename]-> [FilePreservationState]) with the preservationstate of all files in the list. The preservationstates in the map will be null for all filenames, that are not found in admin data.
      • getPreservationState

        PreservationState getPreservationState​(String filename)
        Get the details of the state of the given file in the bitarchives and admin data.
        Parameters:
        filename - A given file
        Returns:
        the FilePreservationState for the given file. This will be null, if the filename is not found in admin data.
      • getMissingFiles

        Iterable<String> getMissingFiles​(Replica replica)
        Return a list of files marked as missing on this replica. A file is considered missing if it exists in admin data, but is not known in the bit archives. Guaranteed not to recheck the archive, simply returns the list generated by the last test.
        Parameters:
        replica - The replica to get missing files from.
        Returns:
        A list of missing files.
      • getChangedFiles

        Iterable<String> getChangedFiles​(Replica replica)
        Return a list of files with changed checksums on this replica. A file is considered changed if checksum does not compare to admin data. Guaranteed not to recheck the archive, simply returns the list generated by the last test.
        Parameters:
        replica - The replica to get a list of changed files from.
        Returns:
        A list of files with changed checksums.
      • findMissingFiles

        void findMissingFiles​(Replica replica)
        Update the list of files in a given bitarchive. This will be used for the next call to getMissingFiles.
        Parameters:
        replica - The replica to update list of files for.
      • findChangedFiles

        void findChangedFiles​(Replica replica)
        Update the list of checksums in a given replica. This will be used for the next call to getChangedFiles.
        Parameters:
        replica - The replica to update list of files for.
      • getNumberOfMissingFiles

        long getNumberOfMissingFiles​(Replica replica)
        Return the number of missing files for replica. Guaranteed not to recheck the archive, simply returns the number generated by the last test.
        Parameters:
        replica - The replica to get the number of missing files from.
        Returns:
        The number of missing files.
      • getNumberOfChangedFiles

        long getNumberOfChangedFiles​(Replica replica)
        Return the number of changed files for replica. Guaranteed not to recheck the archive, simply returns the number generated by the last test.
        Parameters:
        replica - The replica to get the number of changed files from.
        Returns:
        The number of changed files.
      • getNumberOfFiles

        long getNumberOfFiles​(Replica replica)
        Return the total number of files for replica. Guaranteed not to recheck the archive, simply returns the number generated by the last update.
        Parameters:
        replica - The replica to get the number of files from.
        Returns:
        The number of files.
      • getDateForMissingFiles

        Date getDateForMissingFiles​(Replica replica)
        Return the date for last check of missing files for replica. Guaranteed not to recheck the archive, simply returns the date for the last test.
        Parameters:
        replica - The replica to get date for changed files from.
        Returns:
        The date for last check of missing files.
      • getDateForChangedFiles

        Date getDateForChangedFiles​(Replica replica)
        Return the date for last check of changed files for replica. Guaranteed not to recheck the archive, simply returns the date for the last test.
        Parameters:
        replica - The replica to get date for changed files from.
        Returns:
        The date for last check of changed files.
      • uploadMissingFiles

        void uploadMissingFiles​(Replica replica,
                                String... filenames)
        Check that files are indeed missing on the given replica, and present in admin data and reference replica. If so, upload missing files from reference replica to this replica.
        Parameters:
        replica - The replica to restore files to
        filenames - The names of the files.
      • replaceChangedFile

        void replaceChangedFile​(Replica replica,
                                String filename,
                                String credentials,
                                String checksum)
        Check that the checksum of the file is indeed different to the value in admin data and reference replica. If so, remove missing file and upload it from reference replica to this replica.
        Parameters:
        replica - The replica to restore file to
        filename - The name of the file
        credentials - The credentials used to perform this replace operation
        checksum - The known bad checksum. Only a file with this bad checksum is attempted repaired.
      • getMissingFilesForAdminData

        Iterable<String> getMissingFilesForAdminData()
        Return a list of files represented in replica but missing in AdminData.
        Returns:
        A list of missing files.
      • getChangedFilesForAdminData

        Iterable<String> getChangedFilesForAdminData()
        Return a list of files with wrong checksum or state in admin data.
        Returns:
        A list of files with wrong checksum or state.
      • addMissingFilesToAdminData

        void addMissingFilesToAdminData​(String... filenames)
        Add files unknown in admin.data to admin.data.
        Parameters:
        filenames - The files to add.
      • changeStateForAdminData

        void changeStateForAdminData​(String filename)
        Reestablish admin data to match bitarchive states for file.
        Parameters:
        filename - The file to reestablish state for.