anchor.diff:  
   -include("pushy_sql.hrl").
   
  +-include_lib("eunit/include/eunit.hrl").
  +
   -type node_name() :: binary().
   -type node_state() :: binary().
   -type logging_level() :: 'verbose' | 'normal'.
  
positive.code: 
  
  init([Name, HeartbeatInterval, DeadIntervalCount]) ->
      {ok, initializing, #state{dead_interval=HeartbeatInterval * DeadIntervalCount,
                                name=Name}, 0}.
  
  initializing(timeout, #state{name=Name}=State) ->
      case gproc:reg({n, l, Name}) of
  
negative.code: -type status_binary() :: binary(). % <<"idle">> | <<"ready">> | <<"restarting">> | <<"running">>.
  -type gproc_error() :: ok | {error, no_node}.
  
  -record(eavg, {acc = 0 :: integer(),
                 avg = 0 :: float(),
                 n = 0   :: integer(),
                 tick_interval :: integer(),
                 tref   :: reference()
                }).
  
  -record(state, {dead_interval    :: integer(),
                  name             :: binary(),
                  heartbeats = 0   :: integer(),
                  logging = normal :: logging_level(),
                  observers = [],
                  tref,
                  heartbeat_rate   :: #eavg{}
                 }).
  
  -spec eavg_init(integer(), integer()) -> #eavg{}.
  eavg_init(N, I) ->
      TRef = erlang:start_timer(I, self(), update_avg),
      #eavg{acc=0, avg=0, n=N, tick_interval=I, tref=TRef}.
  
  -spec eavg_tick(#eavg{}) -> #eavg{}.
  eavg_tick(#eavg{acc=Acc, avg=Avg, n=N, tick_interval=I}=EAvg) ->
      ?debugVal(EAvg),
      NAvg = (Avg * (N-1) + Acc)/N,
      TRef = erlang:start_timer(I, self(), update_avg),
      EAvg#eavg{acc=0, avg=NAvg, tref=TRef}.
  
  eavg_inc(#eavg{acc=Acc}=EAvg, Count) ->
      EAvg#eavg{acc=Acc+Count}.
  
  eavg_value(#eavg{avg=Avg}) ->
      Avg.
  
  %%%
  %%% External API
  