pushLocalMirror method

Future<SyncOutcome> pushLocalMirror(
  1. String mountId, {
  2. DriveProgress? onProgress,
})

First sync of a reused directory mount: pushes the local copy up so the node mirrors it exactly, reusing files already present on the node. Unlike the two-way sync, this is authoritative local→remote — it never pulls, modifies, or deletes anything in the local directory, and never raises a conflict (see _pushLocalAuthoritative).

Implementation

Future<SyncOutcome> pushLocalMirror(
  String mountId, {
  DriveProgress? onProgress,
}) async {
  final record = require(mountId);
  final outcome = await _withSession(record, (rpc) async {
    if (record.isGit) {
      return _syncGit(
        record,
        rpc,
        SyncDirection.push,
        onProgress: onProgress,
      );
    }
    return _pushLocalAuthoritative(record, rpc, onProgress: onProgress);
  });
  store.mounts[mountId] = outcome.record;
  await store.save();
  return outcome;
}