Class DownOperation

  • public class DownOperation
    extends AbstractTransferOperation
    The down operation implements a central part of Syncany's business logic. It determines whether other clients have uploaded new changes, downloads and compares these changes to the local database, and applies them locally. The down operation is the complement to the UpOperation.

    The general operation flow is as follows:

    1. List all database versions on the remote storage using the LsRemoteOperation (implemented in listUnknownRemoteDatabases()
    2. Download unknown databases using a TransferManager (if any), skip the rest down otherwise (implemented in downloadUnknownRemoteDatabases()
    3. Load remote database headers (branches) and compare them to the local database to determine a winner using several methods of the DatabaseReconciliator
    4. Determine whether the local branch conflicts with the winner branch; if so, prune conflicting local database versions (using findLosersPruneBranch())
    5. If the apply-changes-flag is switched on, changes are applied to the local file system using the ApplyChangesOperation.
    6. Save local database and update known database list (database files that do not need to be downloaded anymore
    See Also:
    • Method Detail

      • execute

        public DownOperationResult execute()
                                    throws java.lang.Exception
        Executes the down operation, roughly following these steps:
        • Download the remote databases to the local cache folder
        • Read version headers (vector clocks)
        • Determine winner branch
        • Prune local stuff (if local conflicts exist)
        • Apply winner's branch
        • Write names of newly analyzed remote databases (so we don't download them again)
        Specified by:
        execute in class Operation
        Returns an operation-specific operation result
        java.lang.Exception - If the operation fails