anchor.diff:      end.
   
   
  -%%--------------------------------------------------------------------
  -%% @doc
  -%% Replaces storage with a new one of the same name.
  -%% @end
  -%%--------------------------------------------------------------------
  --spec replace_helper(record(), helper:name(), NewHelper :: helpers:helper()) ->
  -    record().
  -replace_helper(#storage{helpers = OldHelpers} = Storage, HelperName, NewHelper) ->
  -    NewHelpers = lists:keyreplace(HelperName, #helper.name, OldHelpers, NewHelper),
  -    Storage#storage{helpers = NewHelpers}.
  -
  -
   -spec update_name(StorageId :: id(), NewName :: name()) -> ok.
   update_name(StorageId, NewName) ->
  -    Result = update(StorageId, fun(#storage{} = Storage) ->
  -        {ok, Storage#storage{name = NewName}}
  -    end),
  -    case Result of
  +    UpdateFun = fun(Storage) -> {ok, Storage#storage{name = NewName}} end,
  +    case update(StorageId, UpdateFun) of
           {ok, _} -> rtransfer_put_storage(StorageId);
           Error -> Error
       end.
  
positive.code: -spec update_admin_ctx(storage:id(), helper:name(), helper:user_ctx()) ->
      ok | {error, term()}.
  update_admin_ctx(StorageId, HelperName, Changes) when is_map(Changes) ->
      Updater = fun(Helper) -> helper:update_admin_ctx(Helper, Changes) end,
      update_helper(StorageId, HelperName, Updater).
  
  
  %%--------------------------------------------------------------------
  
negative.code: %%--------------------------------------------------------------------
  %% @private
  %% @doc
  %% Replaces storage with given name.
  %% @end
  %%--------------------------------------------------------------------
  -spec replace_helper(record(), helper:name(), NewHelper :: helpers:helper()) ->
      record().
  replace_helper(#storage{helpers = OldHelpers} = Storage, HelperName, NewHelper) ->
      NewHelpers = lists:keyreplace(HelperName, #helper.name, OldHelpers, NewHelper),
      Storage#storage{helpers = NewHelpers}.
  
  
  %%--------------------------------------------------------------------
  %% @private
  %% @doc
  %% Adds or updates storage in rtransfer config.
  %% @end
  %%--------------------------------------------------------------------
  