Setting up store for different data types

32 views
Skip to first unread message

Jeremy Cox

unread,
Jun 14, 2016, 12:54:55 PM6/14/16
to project-...@googlegroups.com
Thanks for Voldemort and the great community answering questions.

I want to use Voldemort to store long keys and long[] values.
These types require the fewer conversion steps into the data, which is a bit array.  (Java BitSet class interconverts to long[]).

I generated errors with my attempt to change stored data types from <String, String> to <byte[], byte[]> and the second attempt to change from <String, String> to <Long, long[]>.  Ultimately, the put() operation could not convert those to Strings.
This leads to my question.  
Am I correct to say that Voldemort must always use keys and values that are String?

If there are options, how do I set it up?  In the config/STORES/ subdirectory, where store configuration files are stored, there are settings for keys and values, which I believe use XML data types?
 "  <value-serializer>
    <type>string</type>
  </value-serializer>" 

Arunachalam

unread,
Jun 14, 2016, 12:59:58 PM6/14/16
to project-...@googlegroups.com
Voldemort on server side, stores only byte arrays. 

Depending on the serializer you specify, clients will convert them to byte array on write and from byte array to the object on read.

So if your store, has String , String type in the stores xml, you should use String, String.

I recommend you to learn Avro and just use Voldemort Avro stores. This way you just learn on serialization API and you can leverage voldemort as a generic key/value store for all avro schemas.

Thanks,
Arun.

On Tue, Jun 14, 2016 at 9:54 AM, Jeremy Cox <jeremy...@gmail.com> wrote:
Thanks for Voldemort and the great community asking questions.

--
You received this message because you are subscribed to the Google Groups "project-voldemort" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-voldem...@googlegroups.com.
Visit this group at https://groups.google.com/group/project-voldemort.
For more options, visit https://groups.google.com/d/optout.

Jeremy Cox

unread,
Jun 14, 2016, 3:35:58 PM6/14/16
to project-voldemort

I made these changes.  I can change the store configuration file types to "bytes". 

CODE:

import voldemort.utils.ByteArray;

ClientConfig clientConfig = new ClientConfig();
clientConfig.setEnableSerializationLayer(false);
clientConfig.setBootstrapUrls(URL)
                    .setEnableLazy(false)
                    .setRequestFormatType(RequestFormatType.VOLDEMORT_V3);

SocketStoreClientFactory factory = new SocketStoreClientFactory(clientConfig);
StoreClient<ByteArray, byte[]> client = factory.getStoreClient(storeName);


Arunachalam

unread,
Jun 14, 2016, 4:22:32 PM6/14/16
to project-...@googlegroups.com
if you store is key -> string, value -> string , you should use StoreClient as String, String. If you have bytes, you should use byte[], byte[]

I would recommend you to look at the serializer code to see what each object serializes and de-serializes to.

Thanks,
Arun.

Reply all
Reply to author
Forward
0 new messages