anchor.diff:          timeout_fun = TimeoutFun,
           ddoc_name = DDocName,
           view_name = ViewName,
  -        view = View
  +        view = View,
  +        aggregation_results=[],
  +        aggregation_kvs=[]
       }.
   
   send_changes(Acc, Dir, FirstRound) ->
  
positive.code: end_sending_changes(Callback, UserAcc, EndSeq, ResponseType) ->
      Callback({stop, EndSeq}, ResponseType, UserAcc).
  
  changes_enumerator(Value0, Acc) ->
      #changes_acc{
          filter = Filter, callback = Callback, prepend = Prepend,
          user_acc = UserAcc, limit = Limit, resp_type = ResponseType, db = Db,
          timeout = Timeout, timeout_fun = TimeoutFun, view = View
      } = Acc,
      {Value, Results0} = case {View, Filter} of
          {_, {fast_view, _, _, _}} ->
              fast_view_filter(Db, Value0, Filter);
          {#mrview{}, _} ->
              {Value0, view_filter(Db, Value0, Filter)};
          {_, _} ->
              {Value0, filter(Db, Value0, Filter)}
      end,
      Results = [Result || Result <- Results0, Result /= null],
  
negative.code:         filter = Filter,
          view = View
      } = Acc,
      DbEnumFun = fun changes_enumerator/2,
      case can_optimize(FirstRound, Filter) of
          {true, Fun} ->
              Fun(Db, StartSeq, Dir, DbEnumFun, Acc, Filter);
          _ ->
              case {View, Filter}  of
                  {#mrview{}, {fast_view, _, _, _}} ->
                      couch_mrview:view_changes_since(View, StartSeq, DbEnumFun, [{dir, Dir}], Acc);
                  {undefined, _} ->
                      couch_db:changes_since(Db, StartSeq, DbEnumFun, [{dir, Dir}], Acc);
                  {#mrview{}, _} ->
                      ViewEnumFun = fun view_changes_enumerator/2,
                      {Go, Acc0} = couch_mrview:view_changes_since(View, StartSeq, ViewEnumFun, [{dir, Dir}], Acc),
                      case Acc0 of
                          #changes_acc{aggregation_results=[]} ->
                              {Go, Acc0};
                          _ ->
                              #changes_acc{
                                  aggregation_results = AggResults,
                                  aggregation_kvs = AggKVs,
                                  user_acc = UserAcc,
                                  callback = Callback,
                                  resp_type = ResponseType,
                                  prepend = Prepend
                              } = Acc0,
                              ChangesRow = view_changes_row(AggResults, AggKVs, Acc0),
                              UserAcc0 = Callback({change, ChangesRow, Prepend}, ResponseType, UserAcc),
                              reset_heartbeat(),
                              {Go, Acc0#changes_acc{user_acc=UserAcc0}}
                      end
              end
      end.
  
  