anchor.diff:  -export([start/1,stop/1,get/2,put/3,list/1,list_bucket/2,delete/2]).
   -include_lib("eunit/include/eunit.hrl").
   % @type state() = term().
  --record(state, {dir, fakeSuffix}).
  +-record(state, {dir}).
   
   %% @spec start(Partition :: integer()) ->
   %%          {ok, state()} | {{error, Reason :: term()}, state()}
   %% @doc Start this backend.  'riak_fs_backend_root' must be set in
   %%      Riak's application environment.  It must be set to a string
   %%      representing the base directory where this backend should
  -%%      store its files. 'riak_fs_backend_fake_suffix' maybe set in
  -%%      Riak's application environment for enamble atomic write to fs.
  +%%      store its files.
   start(Partition) ->
       PartitionName = integer_to_list(Partition),
       ConfigRoot = riak:get_app_env(riak_fs_backend_root),
  
positive.code: %% @doc store a atomic value to disk. Write to temp file and rename to
  %%       normal path.
  atomic_write(State, File, Val) ->
      case State#state.fakeSuffix of
          undefined ->
              file:write_file(File, Val);
          Suffix ->
              FakeFile = File ++ Suffix,
              case file:write_file(FakeFile, Val) of
                  ok ->
                      file:rename(FakeFile, File);
                  X -> X
              end
      end.
  
  %% @spec put(state(), BKey :: riak_object:bkey(), Val :: binary()) ->
  
negative.code:             riak:stop("riak_fs_backend_root unset, failing.");
          true -> ok
      end,
      Dir = filename:join([ConfigRoot,PartitionName]),
      {filelib:ensure_dir(Dir), #state{dir=Dir}}.
  
  %% @spec stop(state()) -> ok | {error, Reason :: term()}
  stop(_State) -> ok.
  