anchor.diff:      end).
   
   get_update_seq(DbName) ->
  -    rexi:reply(case couch_db:open(DbName) of
  +    rexi:reply(case couch_db:open(DbName, []) of
       {ok, #db{update_seq = Seq}} ->
           {ok, Seq};
       Error ->
  
positive.code:         rexi:reply(Error)
      end.
  
  
  %%
  %% helper funs
  %%
  
negative.code: 
  -export([get_db_info/1, get_doc_count/1, get_update_seq/1]).
  -export([open_doc/3, open_revs/4, get_missing_revs/2, update_docs/3]).
  -export([all_docs/2]).
  
  -include("fabric.hrl").
  
  -record (view_acc, {
      db,
      limit,
      include_docs,
      offset = nil,
      reduce_fun = fun couch_db:enum_docs_reduce_to_count/1,
      stop_fun,
      group_level = 0
  }).
  
  %% rpc endpoints
  %%  call to with_db will supply your M:F with a #db{} and then remaining args
  
  all_docs(DbName, #view_query_args{keys=nil} = QueryArgs) ->
      {ok, Db} = couch_db:open(DbName, []),
      #view_query_args{
          start_key = StartKey,
          start_docid = StartDocId,
          limit = Limit,
          skip = Skip,
          include_docs = IncludeDocs,
          direction = Dir
      } = QueryArgs,
      StartId = if is_binary(StartKey) -> StartKey; true -> StartDocId end,
      Acc0 = #view_acc{
          db = Db,
          include_docs = IncludeDocs,
          limit = Limit+Skip,
          stop_fun = all_docs_stop_fun(QueryArgs)
      },
      {ok, Acc} = couch_db:enum_docs(Db, StartId, Dir, fun view_fold/3, Acc0),
      if Acc#view_acc.offset == nil ->
          Total = couch_db:get_doc_count(Db),
          rexi:sync_reply({total_and_offset, Total, Total});
      true -> ok end,
      rexi:reply(complete).
  
  get_db_info(DbName) ->
      with_db(DbName, {couch_db, get_db_info, []}).
  
  get_doc_count(DbName) ->
      rexi:reply(case couch_db:open(DbName, []) of
      {ok, Db} ->
          {ok, {Count, _DelCount}} = couch_btree:full_reduce(Db#db.id_tree),
          {ok, Count};
  