anchor.diff:  restart_unfinished_transfers(SpaceId) ->
       {ok, {Restarted, Failed}} = for_each_current_transfer(fun(TransferId, {Restarted0, Failed0}) ->
           case restart(TransferId) of
  +            {ok, not_target_provider} ->
  +                {Restarted0, Failed0};
  +            {ok, not_source_provider} ->
  +                {Restarted0, Failed0};
               {ok, TransferId} ->
                   {[TransferId | Restarted0], Failed0};
               {error, {not_found, transfer}} ->
  
positive.code: %%-------------------------------------------------------------------
  -spec restart(id()) -> {ok, id()} | {error, term()}.
  restart(TransferId) ->
      TimeSeconds = provider_logic:zone_time_seconds(),
      UpdateFun = fun(Transfer) ->
  
          TransferStatus = case Transfer#transfer.status of
              completed -> completed;
              skipped -> skipped;
              cancelled -> cancelled;
              _ -> scheduled
          end,
  
          InvalidationStatus = case Transfer#transfer.invalidation_status of
              completed -> completed;
              skipped -> skipped;
              cancelled -> cancelled;
              _ -> scheduled
          end,
  
          {ok, Transfer#transfer{
              status = TransferStatus,
              invalidation_status = InvalidationStatus,
              files_to_transfer = 0,
              files_transferred = 0,
              bytes_to_transfer = 0,
              bytes_transferred = 0,
              files_invalidated = 0,
              files_to_invalidate = 0,
              start_time = TimeSeconds,
              last_update = #{},
              min_hist = #{},
              hr_hist = #{},
              dy_hist = #{},
              mth_hist = #{}
          }}
      end,
      case update(TransferId, UpdateFun) of
          {ok, TransferId} ->
  
negative.code: -spec get_posthooks() -> [datastore_hooks:posthook()].
  get_posthooks() ->
      [fun maybe_mark_completed/3].
  
  %%-------------------------------------------------------------------
  %% @private
  %% @doc
  %% Moves given TransferId from past to current transfers links tree if
  %% the transfer is not ongoing.
  %% @end
  %%-------------------------------------------------------------------
  -spec maybe_move_from_past_to_current_links_tree(id(), transfer()) -> ok.
  maybe_move_from_past_to_current_links_tree(TransferId, T = #transfer{space_id = SpaceId}) ->
      case is_ongoing(T) of
          false ->
              ok = add_link(?CURRENT_TRANSFERS_KEY, TransferId, SpaceId),
              ok = delete_links(?PAST_TRANSFERS_KEY, TransferId, SpaceId);
          _ ->
              ok
      end.
  