anchor.diff:      ;
   
   % return my clusters
  -on_active({query_clustering, Pid}, {Centroids, _Epoch, _ResetTriggerState, _ClusterTriggerState} = State) ->
  -    comm:send(Pid, {query_clustering_response, Centroids}),
  +on_active({query_clustering, Pid}, #state_active{centroids=C} = State) ->
  +    comm:send(Pid, {query_clustering_response, C}),
       State
       ;
   
  -on_active({query_epoch, Pid},
  -    {_Centroids, Epoch,_ResetTriggerState, _ClusterTriggerState} = State) ->
  -    comm:send(Pid, {query_epoch_response, Epoch}),
  +on_active({query_epoch, Pid}, #state_active{local_epoch=E} = State) ->
  +    comm:send(Pid, {query_epoch_response, E}),
       State
       .
   
  
positive.code: init({ResetTrigger, ClusterTrigger}) ->
      ResetTriggerState = trigger:init(ResetTrigger, fun get_clustering_reset_interval/0, reset_clustering),
      ClusterTriggerState = trigger:init(ClusterTrigger, fun get_clustering_interval/0, start_clustering_shuffle),
      {inactive, msg_queue:new(), ResetTriggerState, ClusterTriggerState}.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Message Loop
  
negative.code: %% @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}
            , #state_active{
                            reset_trigger_state=ResetTriggerState
                            , cluster_trigger_state=ClusterTriggerState
                            , radius=R
                        }) ->
      log:log(info, "[ Clustering ~.0p ] deactivating...~n", [comm:this()]),
      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
  