anchor.diff:  %% @doc Rebalance the cluster. Operates on a single bucket. Will
   %% either return ok or exit with reason 'stopped' or whatever reason
   %% was given by whatever failed.
  -rebalance([], _, _, _) ->
  -    ok;
  -rebalance([Bucket|Buckets], NumBuckets, KeepNodes, EjectNodes) ->
  -    BucketCompletion = 1.0 - (length(Buckets)+1) / NumBuckets,
  -    AllNodes = KeepNodes ++ EjectNodes,
  -    ns_orchestrator:update_progress(
  -      dict:from_list([{N, BucketCompletion} || N <- AllNodes])),
  +rebalance(Bucket, KeepNodes, EjectNodes, BucketCompletion, NumBuckets) ->
       {_, _, Map, _} = ns_bucket:config(Bucket),
  -    ns_bucket:set_servers(Bucket, KeepNodes ++ EjectNodes),
       Histograms1 = histograms(Map, KeepNodes),
       Moves1 = master_moves(Bucket, EjectNodes, Map, Histograms1),
       ProgressFun =
  
positive.code:         throw:stopped ->
              fixup_replicas(Bucket, KeepNodes, EjectNodes),
              exit(stopped)
      end,
      rebalance(Buckets, NumBuckets, KeepNodes, EjectNodes).
  
  
  %% @doc Determine if a particular bucket is unbalanced. Returns true
  
negative.code: 
  -include("ns_common.hrl").
  
  -export([failover/1,
           generate_initial_map/3,
           rebalance/3,
           unbalanced/2]).
  
  
  