Class UpOperation


  • public class UpOperation
    extends AbstractTransferOperation
    The up operation implements a central part of Syncany's business logic. It analyzes the local folder, deduplicates new or changed files and uploads newly packed multichunks to the remote storage. The up operation is the complement to the DownOperation.

    The general operation flow is as follows:

    1. Load local database (if not already loaded)
    2. Analyze local directory using the StatusOperation to determine any changed/new/deleted files
    3. Determine if there are unknown remote databases using the LsRemoteOperation, and skip the rest if there are
    4. If there are changes, use the Deduper and Indexer to create a new DatabaseVersion (including new chunks, multichunks, file contents and file versions).
    5. Upload new multichunks (if any) using a TransferManager
    6. Save new DatabaseVersion to a new (delta) MemoryDatabase and upload it
    7. Add delta database to local database and store it locally
    Besides the normal behavior of creating transactions from local changes and uploading these, this class is also able to upload existing transactions that have been interrupted during a previous upload attempt. The up operation analyzes maps the local changes over a number of transactions. The size of these transactions are based on the settings in UpOperationOptions. If a sequence of transactions is interrupted, all queued transactions are written to disk to be resumed later. The next up operation then reads these transactions and resumes them in the same order as they were queued before the interruption.
    • Method Detail

      • execute

        public UpOperationResult execute()
                                  throws java.lang.Exception
        Description copied from class: Operation
        Executes the operation synchronously and returns a result when the operation exits. Using covariance is recommend, that is OperationFoo should override execute so as to return a OperationFooResult rather than OperationResult.
        Specified by:
        execute in class Operation
        Returns:
        Returns an operation-specific operation result
        Throws:
        java.lang.Exception - If the operation fails
      • saveDeltaDatabase

        protected void saveDeltaDatabase​(MemoryDatabase db,
                                         java.io.File localDatabaseFile)
                                  throws java.io.IOException
        Serializes a MemoryDatabase to a file, using the configured transformer.
        Throws:
        java.io.IOException