Interface DeduperListener
-
public interface DeduperListener
Listener interface used by theDeduperto notify the caller of file events, and to retrieve information about chunks and output files.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MultiChunkEntry.MultiChunkIdcreateNewMultiChunkId(Chunk firstChunk)Called byDeduperduring the deduplication process before a newMultiChunkis created/opened.java.io.FilegetMultiChunkFile(MultiChunkEntry.MultiChunkId multiChunkId)Called byDeduperduring the deduplication process before a newMultiChunkis created/opened.booleanonChunk(Chunk chunk)voidonFileAddChunk(java.io.File file, Chunk chunk)Called byDeduperduring the deduplication process for each chunk that was found in the given file.voidonFileEnd(java.io.File file, byte[] checksum)Called byDeduperafter the deduplication process of the given file, i.e.booleanonFileFilter(java.io.File file)Called byDeduperbefore a file is processed.booleanonFileStart(java.io.File file)Called byDeduperbefore the deduplication process is started, and before the file is opened.voidonFinish()Called byDeduperafter finishing the deduplication process.voidonMultiChunkClose(MultiChunk multiChunk)Called byDeduperduring the deduplication process whenever a multichunk is closed.voidonMultiChunkOpen(MultiChunk multiChunk)Called byDeduperduring the deduplication process whenever a newMultiChunkis created/opened.voidonMultiChunkWrite(MultiChunk multiChunk, Chunk chunk)voidonStart(int fileCount)Called byDeduperbefore starting the deduplication process.
-
-
-
Method Detail
-
onFileFilter
boolean onFileFilter(java.io.File file)
Called byDeduperbefore a file is processed. This method can be used to ignore certain files. The method must returntrueif the deduper shall continue processing, orfalseif a file should be skipped.For files excluded by this method, neither
onFileStart()noronFileEnd()are called.- Parameters:
file- File that is evaluated by the filter- Returns:
- Returns
trueif the given file shall be processed,falseotherwise
-
onFileStart
boolean onFileStart(java.io.File file)
Called byDeduperbefore the deduplication process is started, and before the file is opened. The method must returntrueif the deduplication process should continue (e.g. for regular files), andfalseotherwise (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
trueif the given file shall be deduplicated,falseotherwise
-
onFileAddChunk
void onFileAddChunk(java.io.File file, Chunk chunk)
Called byDeduperduring 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 emittedchunk- The new chunk that the chunker emitted
-
onFileEnd
void onFileEnd(java.io.File file, byte[] checksum)
Called byDeduperafter 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 finishedchecksum- File checksum for the entire file content (using the checksum algorithm of the chunker)
-
onChunk
boolean onChunk(Chunk chunk)
Called byDeduperduring the deduplication process whenever then break condition of theChunkerwas reached and a newChunkwas emitted. This method returnstrueif the chunk is a new (and should be further processed), andfalseotherwise.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
falsehas this effect. Returningtruelets 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 byonFileStart().- Parameters:
chunk- The new chunk that the chunker emitted- Returns:
- Returns
trueif the chunk is new, andfalseotherwise
-
onMultiChunkOpen
void onMultiChunkOpen(MultiChunk multiChunk)
Called byDeduperduring the deduplication process whenever a newMultiChunkis 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 byDeduperduring the deduplication process before a newMultiChunkis 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 byDeduperduring the deduplication process before a newMultiChunkis 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 byDeduperduring the deduplication process whenever a newChunkis written to the given multichunk.- Parameters:
multiChunk- The multichunk the given chunk is being written tochunk- The chunk that's written to the multichunk
-
onMultiChunkClose
void onMultiChunkClose(MultiChunk multiChunk)
Called byDeduperduring 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 byDeduperbefore starting the deduplication process.- Parameters:
fileCount- the number of files to be processed
-
-