Package org.syncany.operations.cleanup
Class CleanupOperation
- java.lang.Object
-
- org.syncany.operations.Operation
-
- org.syncany.operations.AbstractTransferOperation
-
- org.syncany.operations.cleanup.CleanupOperation
-
public class CleanupOperation extends AbstractTransferOperation
The purpose of the cleanup operation is to keep the local database and the remote repository clean -- thereby allowing it to be used indefinitely without any performance issues or storage shortage.The responsibilities of the cleanup operations include:
- Remove old
FileVersion
and their corresponding database entities. In particular, it also removesPartialFileHistory
s,FileContent
s,Chunk
s andMultiChunk
s. - Merge metadata of a single client and remove old database version files from the remote storage.
High level strategy:
- Lock repo and start thread that renews the lock every X seconds
- Find old versions / contents / ... from database
- Delete these versions and contents locally
- Delete all remote metadata
- Obtain consistent database files from local database
- Upload new database files to repo
- Remotely delete unused multichunks
- Stop lock renewal thread and unlock repo
Important issues: All remote operations MUST check if the lock has been recently renewed. If it hasn't, the connection has been lost.
- Remove old
-
-
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 CleanupOperation(Config config)
CleanupOperation(Config config, CleanupOperationOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CleanupOperationResult
execute()
Executes the operation synchronously and returns a result when the operation exits.-
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
-
CleanupOperation
public CleanupOperation(Config config)
-
CleanupOperation
public CleanupOperation(Config config, CleanupOperationOptions options)
-
-
Method Detail
-
execute
public CleanupOperationResult 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.
-
-