Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Riak.find/3 vs Riak.find/4 better #55

Open
fire opened this issue Apr 22, 2017 · 1 comment
Open

Document Riak.find/3 vs Riak.find/4 better #55

fire opened this issue Apr 22, 2017 · 1 comment

Comments

@fire
Copy link

fire commented Apr 22, 2017

There is confusion between bucket types and bucket datatypes that are crdt. I had some issues using strongly consistent types. I suggest saying that Riak.find/3 works with types while Riak.find/4 works with crdt datatypes or redoing the abstraction.

http://docs.basho.com/riak/kv/2.2.3/developing/usage/bucket-types/

# [Already started] 3 node riak cluster
riak-admin bucket-type create strongly_consistent \ 
  '{"props":{"consistent":true}}'
riak-admin bucket-type activate strongly_consistent
# Test if the cluster is working
curl -v 172.17.0.2:8098/types/strongly_consistent/buckets/test/keys/hello \
  -X PUT \
  -H "Content-type: text/plain" \
  -d "world"
curl -v 172.17.0.2:8098/types/strongly_consistent/buckets/test/keys/hello
# Elixir
{:ok, pid} = Riak.Connection.start_link('172.17.0.2', 8087)
{:ok, #PID<0.399.0>}
iex(3)> Riak.find(pid, "strongly_consistent", "test", "hello")  
nil
iex(14)> Riak.find(pid, {"strongly_consistent", "test"}, "hello")
%Riak.Object{bucket: {"strongly_consistent", "test"},
 content_type: 'text/plain', data: "world", key: "hello",
 metadata: {:dict, 3, 16, 16, 8, 80, 48,
  {[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []},
  {{[], [], [], [], [], [], [], [], [], [],
    [["content-type", 116, 101, 120, 116, 47, 112, 108, 97, 105, 110],
     ["X-Riak-VTag", 51, 66, 120, 87, 50, 84, 53, 68, 117, 97, 117, 71, 72,
      85, 89, 101, 80, 55, 65, 109, 109, 118]], [], [],
    [["X-Riak-Last-Modified" | {1492, 865281, 773593}]], [], []}}},
 type: "strongly_consistent",
 vclock: <<107, 206, 97, 96, 96, 96, 204, 96, 74, 97, 96, 73, 45, 78, 45,
   204, 96, 202, 99, 101, 112, 0, 9, 1, 105, 198, 179, 249, 151, 248, 178,
   0>>}
@fire
Copy link
Author

fire commented Apr 22, 2017

I suggest using Riak.find(pid, "default", "test", "hello") as an alias for Riak.find(pid, "test", "hello").
[Or the other way around.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant