Class Indexer


  • public class Indexer
    extends java.lang.Object
    The indexer combines the chunking process with the corresponding database lookups for the resulting chunks. It implements the deduplication mechanism of Syncany.

    The class takes a list of files as input and uses the Deduper to break these files into individual chunks. By implementing the DeduperListener, it reacts on chunking events and creates a new database version (with the newly added/changed/removed files. This functionality is entirely implemented by the index() method.

    The class uses the currently loaded MemoryDatabase as well as a potential dirty database into account. Lookups for chunks and file histories are performed on both databases.

    • Constructor Summary

      Constructors 
      Constructor Description
      Indexer​(Config config, Deduper deduper)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void index​(java.util.List<java.io.File> files, java.util.List<java.io.File> deletedFiles, java.util.Queue<DatabaseVersion> databaseVersionQueue)
      This method implements the index/deduplication functionality of Syncany.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • index

        public void index​(java.util.List<java.io.File> files,
                          java.util.List<java.io.File> deletedFiles,
                          java.util.Queue<DatabaseVersion> databaseVersionQueue)
                   throws java.io.IOException
        This method implements the index/deduplication functionality of Syncany. It uses a Deduper to break files down, compares them to the local database and creates a new DatabaseVersion as a result.

        Depending on what has changed, the new database version will contain new instances of PartialFileHistory, FileVersion, FileContent, ChunkEntry and MultiChunkEntry.

        Parameters:
        files - List of files to be deduplicated
        deletedFiles - List of files that have been deleted
        databaseVersionQueue - Queue to which created databaseVersions are offered
        Throws:
        java.io.IOException - If the chunking/deduplication cannot read/process any of the files