anchor.diff:  -define(LOG_INTERVAL, 10000).
   
   %% State record.
  --record(state, {actor, cache, impressions}).
  +-record(state, {actor, impressions}).
   
   %%%===================================================================
   %%% API
  
positive.code: %% under the License.
  %%
  %% -------------------------------------------------------------------
  
  %% @todo I don't believe the cache is even necessary, but use it for
  %%       now.  At this point, it's superfluous, given that it
  %%       immediately updates the cache on update.
  
  -module(lasp_advertisement_counter_client).
  -author("Christopher Meiklejohn <christopher.meiklejohn@gmail.com>").
  
negative.code:     schedule_logging(),
  
      {noreply, State};
  handle_info(view, #state{actor=Actor, impressions=Impressions}=State0) ->
      %% Get current value of the list of advertisements.
      {ok, Ads} = lasp:query({?ADS_WITH_CONTRACTS, ?SET_TYPE}),
  
      %% Select random.
      Random = lasp_support:puniform(sets:size(Ads)),
  
      %% @todo Exposes internal details of record.
      {{ad, _, _, Counter},
       _Contract} = lists:nth(Random, sets:to_list(Ads)),
  
      %% Increment counter.
      {ok, _} = lasp:update(Counter, increment, Actor),
  
      %% Increment impressions.
      State = State0#state{impressions=Impressions+1},
  
      %% Schedule advertisement counter impression.
      schedule_impression(),
  
      {noreply, State};
  handle_info(Msg, State) ->
      lager:warning("Unhandled messages: ~p", [Msg]),
      {noreply, State}.
  