anchor.diff:                     [],
                      state()) -> {ok, any()} | {async, fun()} | {error, term()}.
   fold_buckets(FoldBucketsFun, Acc, _Opts, #state{opts=BitcaskOpts,
  -                                                data_file=DataFile,
  +                                                data_dir=DataFile,
                                                   root=DataRoot,
                                                   async_folds=true}) ->
       FoldFun = fold_buckets_fun(FoldBucketsFun),
  
positive.code:     end.
  
  %% @private
  check_symlink(LinkFile, DeleteExisting) ->
      case file:read_link(LinkFile) of
          {ok, DataFile} ->
              case DeleteExisting of
                  true ->
                      file:delete(LinkFile),
                      make_symlink(LinkFile);
                  false ->
                      {ok, DataFile}
              end;
          {error, enoent} ->
              make_symlink(LinkFile);
          Error ->
              Error
      end.
  
  %% @private
  make_symlink(LinkFile) ->
      {MegaSecs, Secs, MicroSecs} = erlang:now(),
      LinkAbsPath = filename:absname(LinkFile),
      DataFile = [filename:basename(LinkFile),
                  "-",
                  integer_to_list(MegaSecs),
                  integer_to_list(Secs),
                  integer_to_list(MicroSecs)],
      case filelib:ensure_dir(LinkAbsPath) of
          ok ->
              case file:make_symlink(DataFile,
                                     LinkAbsPath) of
                  ok ->
                      {ok, DataFile};
                  {error, Reason} ->
                      lager:error("Failed to create bitcask dir ~s: ~p",
                                  [DataFile, Reason]),
                      {error, Reason}
              end;
          {error, Reason1} ->
              lager:error("Failed to create bitcask dir ~s: ~p",
                          [DataFile, Reason1]),
              {error, Reason1}
      end.
  
  %% @private
  drop_data_cleanup(DataRoot, LinkFile, DataFile) ->
      fun() ->
              %% List all the directories in data root
              case file:list_dir(DataRoot) of
                  {ok, Dirs} ->
                      LinkBase = filename:basename(LinkFile),
                      %% Delete the contents of each directory and
                      %% the directory itself excluding the
                      %% current data directory and the symlink
                      %% pointing to it.
                      [data_directory_cleanup(filename:join(DataRoot, Dir)) ||
                          Dir <- Dirs,
                          Dir /= lists:flatten(DataFile),
                          Dir /= LinkBase,
                          string:left(Dir, length(LinkBase) + 1) =:= (LinkBase ++ "-")];
                  {error, _} ->
                      ignore
              end
  
negative.code: -define(CAPABILITIES, [async_fold]).
  
  -record(state, {ref :: reference(),
                  data_dir :: string(),
                  opts :: [{atom(), term()}],
                  partition :: integer(),
                  root :: string(),
                  async_folds :: boolean()}).
  
  