Exporting data from Riak KV in order to let Android read it offline

Luca Favatella luca.favatella at erlang-solutions.com
Mon Nov 7 11:07:43 EST 2016

Hi All,

What file format easy to read on an Android mobile device would you
recommend for representing a snapshot of part of a live Riak KV store? The
main aim is minimizing development effort on the Android device while
keeping battery consumption reasonable.

As Riak KV can be defined as a key-value store with key being any arbitrary
byte sequence and value being any [MIME-typed][1] arbitrary byte sequence,
I see that any Android-friendly file format / library for reading any such
export needs to:
* Be key-value; and
* Be able to return the value and its MIME type.

[1]: Even values with siblings [can][2] be represented with MIME type.

Some of the alternative file formats include:
* A. SQLite, with columns key (the same as in Riak KV), mime type and value
- respectively of types TEXT, TEXT and BLOB;
* B. Archive (e.g. tar, zip) containing file paths corresponding to
exported Riak KV keys, with file content being the Riak KV [HTTP GET
response][3] - that includes MIME type and body;
* C. Archived (because potentially multi-file) LevelDB database, with the
key being the Riak KV key and the value being the Riak KV [HTTP GET
response][3] - that includes MIME type and body. (Based on a quick search
there is some code for LevelDB on Android.)
Storing the HTTP GET response require the Android application to parse it
for extracting the MIME type and the actual value. (I assume there is some
HTTP parser Android library).


Feel free to suggest libraries / formats that attempt to provide a
"database adapter" on Android by making assumption on the MIME type (e.g.
JSON) of the value. Android libraries that attempt to model / re-use
similar read API as Riak KV HTTP / Protocol Buffers API are welcome too.

I am aware of https://github.com/basho-labs/riak-data-migrator but it does
not seem relevant mainly because:
* The format of the dump on disk (documented as “Protocol Buffer format”)
appears not to be documented / meant for reading as a key-value store by
other software e.g. Android;
* It lists keys in buckets - that I would prefer to avoid because that
operation is expensive and because I would prefer to avoid designing
buckets around a fixed exporting policy.

I am aware of https://github.com/couchbase/couchbase-lite-android but it
seems too much as a read-only offline export. The mobile device does not
need to sync the data: when a new export file is available on the server,
the mobile device can fetch the new file and delete the old one.

Thanks and regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161107/2cdab672/attachment-0002.html>

More information about the riak-users mailing list