anchor.diff:  %% Returns server handle used by couchbeam library to connect to couchdb-based DB.
   %% @end
   %%--------------------------------------------------------------------
  --spec get_server(binary()) -> {ok, {pid, term()}} | {error, term()}.
  +-spec get_server(binary()) -> {ok, {pid(), term()}} | {error, term()}.
   get_server(Bucket) ->
       get_server(datastore_worker:state_get(db_gateways), Bucket).
   
  
positive.code:     State = #{
          server => self(), port_fd => PortFD, status => init, id => {node(), N},
          gw_port => GWPort, gw_admin_port => GWAdminPort, db_hostname => Hostname, db_port => Port,
          start_time => erlang:system_time(milli_seconds), parent => Parent, last_ping_time => -1, bucket => Bucket
      },
      proc_lib:init_ack(Parent, State),
  
  
negative.code: 
      CT = erlang:system_time(milli_seconds),
      MinRestartTime = ST + ?DATASTORE_GATEWAY_SPAWN_TIMEOUT,
  
      FlushBatchDocs = fun(LState) ->
          BatchDocs = maps:get(doc_batch_map, LState),
          {Keys, Docs} = lists:unzip(maps:to_list(BatchDocs)),
          spawn(fun() ->
              Res = db_run(couchbeam, save_docs, [get_db(Bucket), Docs], 3),
              utils:pmap(fun({Pid, Ref}) ->
                  Pid ! {Ref, Res}
              end, Keys)
          end),
          LState#{doc_batch_ts => erlang:system_time(milli_seconds), doc_batch_map = #{}}
      end,
  
      UpdatedState = case CT - DocBatchTS > timer:seconds(1) of
          true ->
              FlushBatchDocs(UpdatedState0);
          false ->
              UpdatedState0
      end,
  
      NewState =
          receive
  