Riak Adapter Improvements #74

Merged
merged 6 commits into from Apr 4, 2013

Projects

None yet

2 participants

@nifoc
Contributor
nifoc commented Apr 4, 2013

This PR does two things:

  1. Changes the way data is "serialized" to Riak, so that riak_search indexes it
  2. Removes the client-side key-generation, because the server can do that for us

Since I only started learning Erlang recently, feel free to critique (and possibly mock) my changes 😄

nifoc added some commits Apr 1, 2013
@nifoc nifoc Fix issues with riak_search
The main issue was that the proplist (that is written to Riak) needs to have keys and values encoded as binary, in order for riak_search to index stuff.

This means that [{foo, "bar"}] will not be index, whereas [{<<"foo">>, <<"bar">>}] will be.

Since this change broke the "internal" (boss_db) search, this was fixed, too.

TODO: After the call to riakc_pb_socket:search we already have the entire object. find_acc fetches it again based on the ID.
4206780
@nifoc nifoc First batch of suggested improvements c912424
@nifoc nifoc Improvements to encoding and decoding
Encoding should be faster, because it happens while constructing the proplist.

I also cleaned up the code quite a bit (no more try/catch. YAY).
8e2068c
@nifoc nifoc Removed client-side key generation
Since Riak can generate the key by itself, I removed everything related to that from the adapter (most of it was c/p from riak_core).
1f21171
@nifoc nifoc Merge branch 'master' into fixes/riak_search 491c704
@nifoc nifoc Use list comprehension instead of lists:map 22f2ee8
@evanmiller
Contributor

Looks good to me!

I'm going to go ahead and merge this in. If I don't hear any complaints about it I will officially graduate the Riak adapter from "experimental" status, since the broken search function was the only thing holding it back from a diploma. Thanks for all your work on this.

@evanmiller evanmiller merged commit e2764be into ErlyORM:master Apr 4, 2013
@nifoc nifoc deleted the nifoc:fixes/riak_search branch Apr 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment