Interface DeduperListener


  • public interface DeduperListener
    Listener interface used by the Deduper to notify the caller of file events, and to retrieve information about chunks and output files.
    • Method Detail

      • onFileFilter

        boolean onFileFilter​(java.io.File file)
        Called by Deduper before a file is processed. This method can be used to ignore certain files. The method must return true if the deduper shall continue processing, or false if a file should be skipped.

        For files excluded by this method, neither onFileStart() nor onFileEnd() are called.

        Parameters:
        file - File that is evaluated by the filter
        Returns:
        Returns true if the given file shall be processed, false otherwise
      • onFileStart

        boolean onFileStart​(java.io.File file)
        Called by Deduper before the deduplication process is started, and before the file is opened. The method must return true if the deduplication process should continue (e.g. for regular files), and false otherwise (e.g. for directories or symlink).

        The method is called for every file that was not excluded by onFileFilter().

        Parameters:
        file - File for which the deduplication process is about to be started
        Returns:
        Returns true if the given file shall be deduplicated, false otherwise
      • onFileAddChunk

        void onFileAddChunk​(java.io.File file,
                            Chunk chunk)
        Called by Deduper during the deduplication process for each chunk that was found in the given file.

        The method is called for every file that was not excluded by onFileFilter().

        Parameters:
        file - File that is being deduplicated, and for which the chunk was emitted
        chunk - The new chunk that the chunker emitted
      • onFileEnd

        void onFileEnd​(java.io.File file,
                       byte[] checksum)
        Called by Deduper after the deduplication process of the given file, i.e. when the end of the file was reached and no more chunks can be emitted. This method also returns the checksum for the entire file content which was created during the process.

        The method is called for every file that was not excluded by onFileFilter().

        Parameters:
        file - File for which the deduplication process is finished
        checksum - File checksum for the entire file content (using the checksum algorithm of the chunker)
      • onChunk

        boolean onChunk​(Chunk chunk)
        Called by Deduper during the deduplication process whenever then break condition of the Chunker was reached and a new Chunk was emitted. This method returns true if the chunk is a new (and should be further processed), and false otherwise.

        This method represents a query to the chunk index, i.e. it determines whether a chunk already exists in the persistence layer. If it does, the chunk should not be added to a multichunk and processing should be stopped. Returning false has this effect. Returning true lets the deduper add the chunk to a multichunk.

        The method is called zero to many times for every file, assuming that the file was not excluded by onFileFilter(), or by onFileStart().

        Parameters:
        chunk - The new chunk that the chunker emitted
        Returns:
        Returns true if the chunk is new, and false otherwise
      • onMultiChunkOpen

        void onMultiChunkOpen​(MultiChunk multiChunk)
        Called by Deduper during the deduplication process whenever a new MultiChunk is created/opened. A new multichunk is opened when the previous multichunk is full.
        Parameters:
        multiChunk - The new multichunk
      • createNewMultiChunkId

        MultiChunkEntry.MultiChunkId createNewMultiChunkId​(Chunk firstChunk)
        Called by Deduper during the deduplication process before a new MultiChunk is created/opened. This method must determine and return a new unique multichunk identifier.
        Parameters:
        firstChunk - The first chunk can/might be used to determine a new multichunk identifier
        Returns:
        Returns a new unique multichunk identifier
      • getMultiChunkFile

        java.io.File getMultiChunkFile​(MultiChunkEntry.MultiChunkId multiChunkId)
        Called by Deduper during the deduplication process before a new MultiChunk is created/opened. In order to determine the destination to which the multichunk should be written, this method returns a multichunk file to a given multichunk ID.
        Parameters:
        multiChunkId - Identifier for the new multichunk
        Returns:
        Returns the (temporary or final) file to which the multichunk should be written
      • onMultiChunkWrite

        void onMultiChunkWrite​(MultiChunk multiChunk,
                               Chunk chunk)
        Called by Deduper during the deduplication process whenever a new Chunk is written to the given multichunk.
        Parameters:
        multiChunk - The multichunk the given chunk is being written to
        chunk - The chunk that's written to the multichunk
      • onMultiChunkClose

        void onMultiChunkClose​(MultiChunk multiChunk)
        Called by Deduper during the deduplication process whenever a multichunk is closed. This can happen either because the multichunk is full (max. size reached/exceeded), or because there are no more files to chunk/index.
        Parameters:
        multiChunk - The multichunk that's being closed
      • onStart

        void onStart​(int fileCount)
        Called by Deduper before starting the deduplication process.
        Parameters:
        fileCount - the number of files to be processed
      • onFinish

        void onFinish()
        Called by Deduper after finishing the deduplication process.