Kaspar -
Russell and I got together and discussed this a little more this morning.
The reason it's not exposed at the IRiakClient and RawClient interfaces is
because the underlying original HTTP client API doesn't support a byte array as
a key; it only uses String. Because of this, our IRiakObject default
implementation only takes a String for a key, and our annotation processing
only works with a String as well. It was all designed around being protocol
neutral to sit on top of both of the old clients.
That being said, what does work perfectly fine is creating a new String from
the byte array. Java does the right thing and this works regardless of whether
you are using the PB or HTTP client:
IRiakClient client = RiakFactory.pbcClient(); // or .httpClient()
Bucket b = client.fetchBucket("this").execute();
byte[] foo = { 0, 5, 120, 1 };
String key = new String(foo);
b.store(key, "this is my value").execute();
IRiakObject o = b.fetch(key).execute();
System.out.println(o.getValueAsString());
client.shutdown();
Thanks!
Brian Roach
On Jul 16, 2012, at 1:01 AM, Russell Brown wrote:
> Hi Kaspar,
>
> Sorry for the slow reply.
>
> On 16 Jul 2012, at 07:49, Kaspar Thommen wrote:
>
>> Anyone please?
>>
>> On Jun 26, 2012 8:57 PM, "Kaspar Thommen" <[email protected]> wrote:
>> Hi,
>>
>> The high-level API in the Java client library (IRiakClient) does not allow
>> one to use byte[] arrays as keys, only Strings, whereas the underlying PBC
>> and http APIs (e.g. com.basho.riak.pbc.RiakClient) do, via the
>> fetch(ByteString, ...) methods. Any reason for this?
>
> Oversight or oversimplifying by me.
>
>
>> Is it planned to add byte array keys to IRiakClient as well at some point?
>
> We should. Please will you raise an issue for it on the RJC github repo[1] to
> ensure we get to it?
>
> Cheers
>
> Russell
>
> [1] Java client issues -
> https://github.com/basho/riak-java-client/issues?direction=desc&sort=created&state=open
>
>>
>> Thanks,
>> Kaspar
>>
>>
>> _______________________________________________
>> riak-users mailing list
>> [email protected]
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com