The watch operation implements the constant synchronization known from other sync tools.
In order to sync instantly, it offers the following strategies:
- It monitors the local file system using the {@link DefaultRecursiveWatcher}. Whenever a file or folder changes, the sync is started (after a short settlement wait period).
- It subscribes to a repo-specific channel on the Syncany pub/sub server, using the {@link NotificationListener}, and publishes updates to this channel.
- It periodically runs the sync, i.e. the {@link DownOperation} and subsequently the {@link UpOperation}. If the other two mechanisms are disabled or fail to register changes, this method will make sure that changes are synced eventually.
As of now, this operation never returns, because it runs in a loop. The user has to manually abort the operation on the command line.
@author Philipp C. Heckel