-spec kick_site(site(), kick_intent()) -> ok |
{error, _}.
Remove a site from the cluster. The target site can be local or remote: a site is allowed to kick itself from the cluster.
The kicked site creates an entirely new cluster ID and joins it as a singleton member.
The local site (i.e. the one that initiates kick) runs the following hooks
with Intent equal to the value of the argument:
classy:pre_kick/2.
It can decide that removing a site is unsafe and abort the command.
classy:on_kick_decided/2
is called once the decision to kick is finalized.
The target site executes the following hook before it leaves the cluster:
classy:on_leave/2.
Semantically, at this point it is still in the old cluster,
and the old membership information is retained.
Then it executes the hooks characteristic of the creation of a new cluster.
NOTE: The intent is not propagated across different sites.
If the target site is not the same as the local site,
then the target runs classy:on_leave/2 with the predefined intent kicked.
NOTE: If the target site is in the process of joining the cluster, the kick operation aborts the ongoing join.