anchor.diff:           buckets_replication_statuses/0,
            eject_nodes/1]).
   
  +-export([wait_local_buckets_shutdown_complete/0]). % used via rpc:multicall
  +
   
   -define(DATA_LOST, 1).
   -define(BAD_REPLICATORS, 2).
   
  +-define(BUCKETS_SHUTDOWN_WAIT_TIMEOUT, 20000).
   
   %%
   %% API
  
positive.code:     {MapRV, _} = generate_vbucket_map(Map1, Servers, BucketConfig),
      MapRV.
  
  
  rebalance(KeepNodes, EjectNodesAll, FailedNodesAll) ->
      %% TODO: pull config reliably here as well
  
negative.code:         {error, SyncFailedNodes} ->
              exit({pre_rebalance_config_synchronization_failed, SyncFailedNodes})
      end,
  
      %% now wait when all bucket shutdowns are done on nodes we're
      %% adding (or maybe adding)
      do_wait_buckets_shutdown(KeepNodes),
  
      %% don't eject ourselves at all here; this will be handled by ns_orchestrator
      EjectNodes = EjectNodesAll -- [node()],
  