anchor.diff:              end
       end.
   
  +
   check_is_admin(_Db) ->
       ok.
   
  -
  -
  +handle_changes(ChangesArgs, Req, #db{filepath = undefined} = Db) ->
  +    exit(not_implemented(handle_changes, [ChangesArgs, Req, Db]));
   handle_changes(ChangesArgs, Req, Db) ->
       couch_changes:handle_changes(ChangesArgs, Req, Db).
   
   start_view_compact(DbName, GroupId) ->
       exit(not_implemented(start_view_compact, [DbName, GroupId])).
   
  +start_db_compact(#db{filepath = undefined} = Db) ->
  +    couch_db:start_compact(Db);
   start_db_compact(Db) ->
       exit(not_implemented(start_db_compact, [Db])).
   
   cleanup_view_index_files(Db) ->
       couch_view:cleanup_index_files(Db).
   
  +get_group_info(#db{filepath = undefined} = Db, DesignId) ->
  +    with_subdb(Db, <<"master">>,
  +               fun (RealDb) ->
  +                       couch_view:get_group_info(RealDb, DesignId)
  +               end);
   get_group_info(Db, DesignId) ->
  -    with_vbucket_db(Db, 0,
  -                    fun (RealDb) ->
  -                            couch_view:get_group_info(RealDb, DesignId)
  -                    end).
  +    couch_view:get_group_info(Db, DesignId).
   
   create_db(DbName, UserCtx) ->
       exit(not_implemented(create_db, [DbName, UserCtx])).
   
   delete_db(DbName, UserCtx) ->
       exit(not_implemented(delete_db, [DbName, UserCtx])).
  -
  -update_docs(Db, Docs, Options) ->
  -    case is_couchbase_db(Db#db.name) of
  -        false -> couch_db:update_docs(Db, Docs, Options)
  -    end.
  -
  -update_docs(Db, Docs, Options, Type) ->
  -    case is_couchbase_db(Db#db.name) of
  -        false -> couch_db:update_docs(Db, Docs, Options, Type)
  -    end.
   
   purge_docs(Db, IdsRevs) ->
       %% couch_db:purge_docs(Db, IdsRevs).
  
positive.code: -compile(export_all).
  
  -include("couch_db.hrl").
  -include("ns_common.hrl").
  
  -compile(export_all).
  
  not_implemented(_Arg, _Rest) ->
      exit({_Arg, not_implemented}).
  
  do_db_req(#httpd{user_ctx=UserCtx,path_parts=[DbName|_]}=Req, Fun) ->
      case couch_db:open(DbName, [{user_ctx, UserCtx}]) of
          {ok, Db} ->
              try
                  Fun(Req, Db)
                  after
                      catch couch_db:close(Db)
                  end;
          Error ->
              throw(Error)
      end.
  
  
  %% Required for replication
  get_db_info(Db) ->
      case is_couchbase_db(Db#db.name) of
          false -> couch_db:get_db_info(Db)
      end.
  
  
  with_vbucket_db(Db, VBucket, Fun) ->
      DbName = iolist_to_binary([Db#db.name, $/, integer_to_list(VBucket)]),
      {ok, RealDb} = couch_db:open(DbName, []),
      try
          Fun(RealDb)
      after
  
negative.code: 
  -spec all_databases() -> {ok, [binary()]}.
  all_databases() ->
      {ok, DBs} = couch_server:all_databases(),
      {ok, DBs ++ [?l2b(Name) || Name <- ns_bucket:get_bucket_names(membase)]}.
  
  task_status_all() ->
      %% TODO: why ?
      couch_task_status:all().
  
  restart_core_server() ->
  