anchor.diff:  %% @doc Message handler when the module is fully initialized.
   -spec on_active(Message::message(), State::state_active()) -> state_active();
            ({deactivate_clustering}, state_active()) -> {'$gen_component', [{on_handler, Handler::gen_component:handler()}], State::state_inactive()}.
  -on_active({deactivate_clustering},
  -          {_Centroids, ResetTriggerState, ClusterTriggerState}) ->
  +on_active({deactivate_clustering}
  +          , #state_active{
  +                          reset_trigger_state=ResetTriggerState
  +                          , cluster_trigger_state=ClusterTriggerState
  +                          , radius=R
  +                      }) ->
       log:log(info, "[ Clustering ~.0p ] deactivating...~n", [comm:this()]),
  -    gen_component:change_handler({inactive, msg_queue:new(), ResetTriggerState, ClusterTriggerState},
  -                                 fun ?MODULE:on_inactive/2);
  +    StateInactive = #state_inactive{
  +        queued_messages = msg_queue:new()
  +        , reset_trigger_state = ResetTriggerState
  +        , cluster_trigger_state = ClusterTriggerState
  +        , radius=R
  +    },
  +    gen_component:change_handler(StateInactive, fun ?MODULE:on_inactive/2);
   
   % ignore activate_clustering messages in active state
   % note: remove this if the clustering process is to be deactivated on leave (see
  
positive.code:                 ignore -> ok;
                  R -> comm:send(R, {clustering_shuffle_reply, comm:this(), Centroids, Epoch})
              end,
              {Epoch, cluster(Centroids, RemoteCentroids)}
      end,
      case NewEpoch of % reset needed?
          Epoch -> {NewCentroids, Epoch, ResetTriggerState, ClusterTriggerState};
          _Else ->
              NewResetTriggerState = trigger:next(ResetTriggerState),
              NewClusterTriggerState = trigger:next(ClusterTriggerState),
              % Note: NewEpoch - 1 because we will increment it in the handler for the
              % vivaldi reply
              {NewCentroids, NewEpoch - 1, NewResetTriggerState, NewClusterTriggerState}
      end
      .
  
negative.code:     {cy_cache, [node:node_type()]} |
      {clustering_shuffle, comm:mypid(), dc_centroids:centroids(), non_neg_integer()} |
      {clustering_shuffle_reply, comm:mypid(), dc_centroids:centroids(), non_neg_integer()} |
      {query_clustering, comm:mypid()} |
      {query_epoch, comm:mypid()}
  ).
  
  %% @doc Sends an initialization message to the node's dc_clustering process.
  -spec activate() -> ok | ignore.
  