sync method
Synchronizes mountId. With no direction, picks one automatically:
read-only mounts always push; read-write mounts push, pull or no-op based
on which side changed. When both sides changed, non-overlapping edits are
auto-merged (local-only edits pushed, remote-only edits pulled) and only a
path edited on both sides surfaces a conflict.
Implementation
Future<SyncOutcome> sync(
String mountId, {
SyncDirection? direction,
DriveProgress? onProgress,
}) async {
final record = require(mountId);
final outcome = await _withSession(record, (rpc) async {
if (record.isGit) {
return _syncGit(record, rpc, direction, onProgress: onProgress);
}
if (direction != null) {
return _syncDirectory(record, rpc, direction, onProgress: onProgress);
}
return _autoSync(record, rpc, onProgress: onProgress);
});
store.mounts[mountId] = outcome.record;
await store.save();
return outcome;
}