map-db

Ildar Alishev ildaralishev at gmail.com
Wed Jan 21 06:41:11 EST 2015


Hi Christopher,

thank you for your answer.
Honestly we work with ugameDb   and order is next

we start executing code (using C# in Unity3d), it goes to ugame db, than after ugamedb it goes to Riak(i think ugameDB use RIAK), and after this it sends us answer.

What code should i send you??? 
it is first time we are working with ugamedb and riak at all, so we are some sort of noobs)


here is some code that i’m using in Unity3d (C#)

public IEnumerator eMapQuery()
    {
        var map = buck.MapReduce(new ErlangMapPhase("unity", "map_phase"), new ErlangReducePhase("unity", "reduce_phase"));
        Debug.Log("Start");
        yield return map.WaitUntilDone();
        if(map.isSuccessful)
        foreach (var item in map.GetResult<Interactor>())
        {
            Debug.Log("Ok");
            foreach (var pair in item.Fields) Debug.Log(pair.Key + " = " + pair.Value.ToString());
        }
        else
        {
            Debug.Log("Fail");
        }
    }

Erlang code here

>> module(unity).
>> -export([map_phase/3, reduce_phase/2]).
>> 
>> map_phase(Value, KeyData, Arg) ->
>>             [dict:from_list([{I, 1}
>>              || I <- binary_to_term(riak_object:get_value(Value))])].
>> 
>> 
>> reduce_phase(ValueList, _Arg) ->
>>             [lists:foldl(fun(Value, Acc) ->
>>                            dict:merge(fun(_, X, Y) -> X+Y end,
>>                                       Value, Acc)
>>                          end,
>>                          dict:new(),
>>                          ValueList)].




ugameDB i don’t know it is their own code.  

Ildar.



> 21 янв. 2015 г., в 13:37, Christopher Meiklejohn <christopher.meiklejohn at gmail.com> написал(а):
> 
> On Wed, Jan 21, 2015 at 10:28 AM, Ildar Alishev <ildaralishev at gmail.com <mailto:ildaralishev at gmail.com>> wrote:
>> Hello everyone.
>> 
>> Have a few questions concerning connecting Erlang (it is client) and Riak 2.0.2
>> 
>> so question is.
>> 
>> i have created and compiled two functions using erlang
>> 
>> -module(unity).
>> -export([map_phase/3, reduce_phase/2]).
>> 
>> map_phase(Value, KeyData, Arg) ->
>>             [dict:from_list([{I, 1}
>>              || I <- binary_to_term(riak_object:get_value(Value))])].
>> 
>> 
>> reduce_phase(ValueList, _Arg) ->
>>             [lists:foldl(fun(Value, Acc) ->
>>                            dict:merge(fun(_, X, Y) -> X+Y end,
>>                                       Value, Acc)
>>                          end,
>>                          dict:new(),
>>                          ValueList)].
>> 
>> 
>> so, now, since i’m using it for uGameDb (want to connect Unity3d and ugameDb), i cannot connect it.
>> Using Unity3d i’m calling MapReduce and… nothing happens. Really, nothing, no errors, nothing.
> 
> Hi Ildar,
> 
> Can you share the code you are using to execute the MapReduce job to
> allow us to debug further?
> 
> Thanks,
> - Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20150121/7e7bc0e6/attachment-0002.html>


More information about the riak-users mailing list