Moved claimant code from riak_core_ring to riak_core_claimant

This commit intentionally does not compile. It will be squashed into
the proceeding commit after development and code review.
Refactor riak_core_ring and riak_core_claimant
Refactor claimant code so that it can be run without side-effects
Add two-phase/staged approach to cluster administration

Add staged clustering as discussed in issue #177. This new approach
to cluster administration operates in two phases. Users first stage
intended cluster changes (join/leave/remove), then commit the changes
when ready and satisfied with how those changes will impact the
cluster. This is supported by turning `riak_core_claimant` into a
gen_server and adding a new API for scheduling and committing staged
changes. Also, `riak_core_console` is updated to provide an interface
to this new API.

Change the claimant logic to no longer automatically transition
`joining` nodes to `valid` nodes. This change is necessary to support
staged joining of nodes.

Change the node removal logic to allow use of a provided seed for
random number generation, to enable the staged clustering system to
calculate the same removal plan during both the planning and commit
phases.
Add replace and force-replace cluster operations

Add support for `replace node new-node` operation that stages a
request for node to handoff all of its partitions to new-node and
then leave the cluster. This is similar to a leave, but directs
handoff to a specific replacement node.

Add support for `force-replace node new-node` operation that stages
a request that reassigns all partitions owned by node to new-node
and removes node from the cluster. This is similar to a force-remove,
but reassigns partitions to a specific replacement node.
Fix 'riak-admin join'

Fix 'riak-admin join' so that it once again works despite the changes
made to node joining as part of the new staged clustering changes. This
is accomplished through the addition of auto-joining logic in the
claimant that transitions 'joining' nodes to 'valid' nodes that were
joined to the cluster using the traditional join rather than the newer
staged join.
Update staged clustering code after review/further testing

Update claim_v2 to compute claim deltas for non-active owning nodes, to
handle corner case hit by new staged clustering code.

Change riak_core_ring_manager:ring_trans to allow code to provide a reason
when ignoring the transaction.

Update riak_core_claimant plan/commit to return reasons for failures.

Fix bug with riak_core_claimant:compute_all_next_rings where two rings were
considered equal when they were not.

Fix bug with riak_core_ring:future_ring where leaving nodes that still owned
partitions would incorrectly be changed to the exiting state.

Add code that enables querying and setting handoff concurrency settings.
Fix capability system race condition during node startup

Resolve issue #186

Add try/catch around riak_core_capability:update_ring logic to handle
the case where a node tries to join a cluster before the capability
system has finished starting up. Exceptional case is handled by not
publishing any capability information in the ring and relying upon
future negotiation.
Update console command to validate provided transfer limit
Merge branch 'gh177-staged-clustering' into jdm-merge-staged-clustering

Resolves merge conflicts between staged clustering and claim sim/claimv3 branches.

Conflicts:
	src/riak_core.erl
	src/riak_core_gossip.erl
	src/riak_core_ring.erl
Fix issues with previous merge and cleanup some -specs

Merge of 'gh177-staged-clustering' and 'master' had a few issues.

Re-add "clear member metadata on leave" logic that was removed in merge.
Re-add riak_core_ring:cancel_transfers/1 that was removed in merge.
Perform minor code clean-up.
Fix some typespecs to make dialyzer happier (more work still needed).

This finalizes integration into 'master' for #181
Merge branch 'jdm-merge-staged-clustering'
Update capability bugfix based on review feedback

Reduce scope of try/catch logic to only catch failures related to
the capabilities ETS table, therefore ensuring we do not silently
catch failures in other parts of the code.

Fix incorrect return value on failure: Ring => {false, Ring}
Merge pull request #186 from basho/gh186-capability-bug
Fix dialyzer commands in Makefile
Fix type spec for `status_update`
Add repair ability

Add the framework needed for services on top of core to provide a
"repair" mechanism.  At this point repair was built with the sole
purpose of repairing data for KV and Search.

The key insight behind repair is that since Riak is a replicated data
store one partition can be rebuilt from the replicas on other
partitions.  Specifically, the adjacent (i.e. before and after)
partitions on the ring, together, contain all the replicas that are
stored on the partition to be repaired.  The rub is that adjacent
partitions also contain replicas that are _not_ meant to be on the
partition under repair.  This means a filter function must be used
while folding over the source partitions to transfer only the data
that belongs.  This is done as efficiently as possible by generating a
hash range for all the buckets and thus avoiding a preflist
calculation for each key.  Only a hash of each key is done, it's range
determined from a bucket->range map, and then the hash is checked
against the range.  The services under repair (i.e. Search or KV) must
provide callback functions to generate these ranges since it is
specific to the service.

In order to not repeat code and capitalize on concurrency control the
repair mechanism is currently an extension of handoff.  This creates
some awkwardness as repair is _not_ handoff.  Some of the differences
include:

1. It needs to filter data during the fold

2. All vnodes involved are primary and thus repair _cannot_ block

3. Repair involves 3 distinct partitions and 3 distinct vnodes

4. Repair does not imply a change of responsibility from one vnode to
another, but is more a sharing of data

In the future the handoff subsystem should be rewritten around the
notion of "transfers" in which repair, handoff, and ownership are all
different logical operations but use the transfer mechanism
underneath.  Especially now that repair is in it should be more clear
what that system should look like to meet the goals of all 3.

The idea of repair lives in the vnode manager as it is very much a
vnode semantic.  This is important because other things like handoff
and ownership also affect vnodes and thus affect repair.  The vnode
manager controls the logical repair, but the handoff/transfer
mechanism controls the physical movement of replicas from source to
target.

For now, it seemed easiest and smartest to _not_ allow ownership
change and repair to run concurrently.  In the event that an ownership
change is detected all repairs will be hard killed, regardless of
status.

In the case were the low-level repair transfer is killed because of
`handoff_concurrency` a msg is _not_ sent back to the vnode mgr to
indicate a failure for that transfer.  Instead, the vnode mgr has a
period tick.  During each tick the vnode mgr checks the status of all
it's repairs and retries any transfers that have since died for a
reason other than completion.
Add ability to get all bucket props

It's useful to be able to get all the bucket properties in one go.
This is used by repair to get the `n_val` for all buckets.
Move common repair stuff into core

Place all common repair functions between Search and KV in the
`riak_core_repair` module.
Remove timeout in handoff mgr

This timeout was leftover from a previous attempt to write repair and
is not used anymore.