Package org.syncany.operations.down
Class DownOperation
- java.lang.Object
-
- org.syncany.operations.Operation
-
- org.syncany.operations.AbstractTransferOperation
-
- org.syncany.operations.down.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 theUpOperation
.The general operation flow is as follows:
- List all database versions on the remote storage using the
LsRemoteOperation
(implemented inlistUnknownRemoteDatabases()
- Download unknown databases using a
TransferManager
(if any), skip the rest down otherwise (implemented indownloadUnknownRemoteDatabases()
- Load remote database headers (branches) and compare them to the local database to determine a winner
using several methods of the
DatabaseReconciliator
- Determine whether the local branch conflicts with the winner branch; if so, prune conflicting
local database versions (using
findLosersPruneBranch()
) - If the apply-changes-flag is switched on, changes are applied to the local file system using the
ApplyChangesOperation
. - Save local database and update known database list (database files that do not need to be downloaded anymore
- See Also:
DatabaseReconciliator
- List all database versions on the remote storage using the
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ACTION_ID
-
Fields inherited from class org.syncany.operations.AbstractTransferOperation
actionHandler, eventBus, transferManager
-
-
Constructor Summary
Constructors Constructor Description DownOperation(Config config)
DownOperation(Config config, DownOperationOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DownOperationResult
execute()
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)-
Methods inherited from class org.syncany.operations.AbstractTransferOperation
finishOperation, getLastRemoteCleanupNumber, getNewestDatabaseFileVersion, otherRemoteOperationsRunning, startOperation
-
-
-
-
Field Detail
-
ACTION_ID
public static final java.lang.String ACTION_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DownOperation
public DownOperation(Config config)
-
DownOperation
public DownOperation(Config config, DownOperationOptions options)
-
-
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)
-
-