anchor.diff:  empty_cache(Node) ->
       update_document(Node, subscriptions_state, ?SUBSCRIPTIONS_STATE_KEY, #{
           cache => gb_trees:empty()
  +    }).
  +
  +empty_first_half_of_cache(Node) ->
  +    {ok, #document{value = #subscriptions_state{cache = Cache}}} =
  +        rpc:call(Node, subscriptions_state, get, [?SUBSCRIPTIONS_STATE_KEY]),
  +
  +    AsList = gb_trees:to_list(Cache),
  +    {MedianSeq, _} = lists:nth(length(AsList) div 2, AsList),
  +    Filtered = lists:filter(fun({Seq, _}) -> Seq > MedianSeq end, AsList),
  +
  +    UpdatedCache = lists:foldl(fun({Seq, Val}, Acc) ->
  +        gb_trees:enter(Seq, Val, Acc)
  +    end, gb_trees:empty(), Filtered),
  +
  +    update_document(Node, subscriptions_state, ?SUBSCRIPTIONS_STATE_KEY, #{
  +        cache => UpdatedCache
  +    }).
  +
  +empty_odd_seqs_in_cache(Node) ->
  +    {ok, #document{value = #subscriptions_state{cache = Cache}}} =
  +        rpc:call(Node, subscriptions_state, get, [?SUBSCRIPTIONS_STATE_KEY]),
  +
  +    AsList = gb_trees:to_list(Cache),
  +    Filter = fun({Seq, _}) -> (Seq rem 2) =:= 0 end,
  +    Filtered = lists:filter(Filter, AsList),
  +
  +    UpdatedCache = lists:foldl(fun({Seq, Val}, Acc) ->
  +        gb_trees:enter(Seq, Val, Acc)
  +    end, gb_trees:empty(), Filtered),
  +
  +    update_document(Node, subscriptions_state, ?SUBSCRIPTIONS_STATE_KEY, #{
  +        cache => UpdatedCache
       }).
   
   call_worker(Node, Req) ->
  
positive.code:     ]),
      ok.
  
  %%%===================================================================
  %%% Setup/teardown functions
  %%%===================================================================
  
negative.code:     updates_for_added_user_test/1,
      updates_for_added_user_have_revisions_test/1,
      updates_have_revisions_test/1,
      fetches_changes_older_than_in_cache/1,
      fetches_changes_from_both_cache_and_db/1,
      fetches_changes_when_cache_has_gaps/1]).
  
  -define(MESSAGES_WAIT_TIMEOUT, timer:seconds(3)).
  -define(MESSAGES_RECEIVE_ATTEMPTS, 30).
  