Interface DeduperListener
-
public interface DeduperListener
Listener interface used by theDeduper
to 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.MultiChunkId
createNewMultiChunkId(Chunk firstChunk)
Called byDeduper
during the deduplication process before a newMultiChunk
is created/opened.java.io.File
getMultiChunkFile(MultiChunkEntry.MultiChunkId multiChunkId)
Called byDeduper
during the deduplication process before a newMultiChunk
is created/opened.boolean
onChunk(Chunk chunk)
void
onFileAddChunk(java.io.File file, Chunk chunk)
Called byDeduper
during the deduplication process for each chunk that was found in the given file.void
onFileEnd(java.io.File file, byte[] checksum)
Called byDeduper
after the deduplication process of the given file, i.e.boolean
onFileFilter(java.io.File file)
Called byDeduper
before a file is processed.boolean
onFileStart(java.io.File file)
Called byDeduper
before the deduplication process is started, and before the file is opened.void
onFinish()
Called byDeduper
after finishing the deduplication process.void
onMultiChunkClose(MultiChunk multiChunk)
Called byDeduper
during the deduplication process whenever a multichunk is closed.void
onMultiChunkOpen(MultiChunk multiChunk)
Called byDeduper
during the deduplication process whenever a newMultiChunk
is created/opened.void
onMultiChunkWrite(MultiChunk multiChunk, Chunk chunk)
void
onStart(int fileCount)
Called byDeduper
before starting the deduplication process.
-
-
-
Method Detail
-
onFileFilter
boolean onFileFilter(java.io.File file)
Called byDeduper
before a file is processed. This method can be used to ignore certain files. The method must returntrue
if the deduper shall continue processing, orfalse
if 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
true
if the given file shall be processed,false
otherwise
-
onFileStart
boolean onFileStart(java.io.File file)
Called byDeduper
before the deduplication process is started, and before the file is opened. The method must returntrue
if the deduplication process should continue (e.g. for regular files), andfalse
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 byDeduper
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 emittedchunk
- The new chunk that the chunker emitted
-
onFileEnd
void onFileEnd(java.io.File file, byte[] checksum)
Called byDeduper
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 finishedchecksum
- File checksum for the entire file content (using the checksum algorithm of the chunker)
-
onChunk
boolean onChunk(Chunk chunk)
Called byDeduper
during the deduplication process whenever then break condition of theChunker
was reached and a newChunk
was emitted. This method returnstrue
if the chunk is a new (and should be further processed), andfalse
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. Returningtrue
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 byonFileStart()
.- Parameters:
chunk
- The new chunk that the chunker emitted- Returns:
- Returns
true
if the chunk is new, andfalse
otherwise
-
onMultiChunkOpen
void onMultiChunkOpen(MultiChunk multiChunk)
Called byDeduper
during the deduplication process whenever a newMultiChunk
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 byDeduper
during the deduplication process before a newMultiChunk
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 byDeduper
during the deduplication process before a newMultiChunk
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 byDeduper
during the deduplication process whenever a newChunk
is 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 byDeduper
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 byDeduper
before starting the deduplication process.- Parameters:
fileCount
- the number of files to be processed
-
-