anchor.diff:  -include("mem3.hrl").
   
   -record (gacc, {
  -    node,
  +    donors,
       targets,
       moves,
       limit,
  
positive.code:                 false
          end
      end,
      case {lists:member(Shard, Shards), lists:dropwhile(Fun, SortedByCount)} of
          {false, _} ->
              Acc0;
          {true, []} ->
              Acc0;
          {true, [{Target, _} | _]} ->
              print({move, Shard, Target}),
              Acc0#gacc{
                  moves = [{move, Shard, Target} | Moves],
                  limit = DC - 1
              }
      end;
  donate_fold(_Shard, Acc) ->
      Acc.
  
  get_shard_count(AtomKey, ShardsByNode) when is_atom(AtomKey) ->
      length(couch_util:get_value(AtomKey, ShardsByNode, [])).
  
negative.code:     end, shard_count_by_node(LocalOps)),
      TotalCount = lists:foldl(fun({_, C}, Sum) -> Sum + C end, 0, CountByNode),
      TargetLevel = TotalCount div length(TargetNodes),
      Donors = [{list_to_existing_atom(binary_to_list(N)), C - TargetLevel} ||
          {N, C} <- CountByNode, C > TargetLevel],
      InternalAcc0 = #gacc{
          donors = orddict:from_list(Donors),
          targets = TargetNodes0,
          moves = LocalOps,
          limit = Limit - length(LocalOps),
          target_level = TargetLevel
      },
      try mem3_shards:fold(fun donate_fold/2, InternalAcc0) of
          #gacc{moves = Moves} ->
              Moves
      catch
          {complete, Moves} ->
              Moves
      end.
  
  donate_fold(_Shard, #gacc{limit = 0, moves = Moves}) ->
      throw({complete, Moves});
  donate_fold(#shard{node = Node} = Shard, Acc0) ->
       #gacc{
          donors = Donors,
          targets = Nodes,
          moves = Moves,
          limit = DC,
  