anchor.diff:  %%          {boolean(), reqdata(), context()}
   %% @doc Determine whether or not a connection to Riak
   %%      can be established. Also, extract query params.
  -service_available(RD, Ctx=#ctx{riak=RiakProps}) ->
  +service_available(RD, Ctx0=#ctx{riak=RiakProps}) ->
  +    Ctx = riak_kv_wm_utils:ensure_bucket_type(RD, Ctx0, #ctx.bucket_type),
       case riak_kv_wm_utils:get_riak_client(RiakProps, riak_kv_wm_utils:get_client_id(RD)) of
           {ok, C} ->
               {true, RD, Ctx#ctx { client=C }};
  
positive.code: -record(ctx, {
            client,       %% riak_client() - the store client
            riak,         %% local | {node(), atom()} - params for riak client
            bucket,       %% The bucket to query.
            index_query,   %% The query..
            max_results :: all | pos_integer(), %% maximum number of 2i results to return, the page size.
  
negative.code: %% @doc Initialize this resource.
  init(Props) ->
      {ok, #ctx{
         riak=proplists:get_value(riak, Props),
         bucket_type=proplists:get_value(bucket_type, Props)
        }}.
  
  
  