anchor.diff:  %% Macros.
   -define(MAX_IMPRESSIONS, 100).
   -define(LOG_INTERVAL, 10000).
  +-define(CONVERGENCE_INTERVAL, 5000).
   -define(ADS, 10).
   
   %% State record.
  
positive.code:     {ok, Ads, AdList}.
  
  %% @private
  track_convergence() ->
      PairType = {?PAIR_TYPE,
                      [
                          ?COUNTER_TYPE,
                          {?GMAP_TYPE, [?BOOLEAN_TYPE]}
                      ]
                  },
      {ok, _} = lasp:declare(?CONVERGENCE_TRACKING, PairType).
  
  %% @private
  launch_triggers(AdList, Ads, Actor) ->
      lists:map(fun(Ad) ->
                        spawn_link(fun() ->
                                           trigger(Ad, Ads, Actor)
                                   end)
                end, AdList).
  
  %% @private
  trigger(#ad{counter=CounterId} = Ad, Ads, Actor) ->
      %% Blocking threshold read for max advertisement impressions.
      {ok, Value} = lasp:read(CounterId, {value, ?MAX_IMPRESSIONS}),
  
      lager:info("Threshold for ~p reached; disabling!", [Ad]),
      lager:info("Counter: ~p", [Value]),
  
      %% Remove the advertisement.
      {ok, _} = lasp:update(Ads, {rmv, Ad}, Actor),
  
      ok.
  
  %% @private
  schedule_logging() ->
  
negative.code:     launch_triggers(AdList, Ads, Actor),
  
      %% Create instance for convergence tracking
      %% Also schedule check convergence
      track_convergence(),
  
      {ok, #state{actor=Actor, ads=Ads}}.
  